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 \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `layouts.h` enumeration!!!!\n\treturn {\n\t\t// Row-major (C-style):\n\t\t'row-major': 101,\n\n\t\t// Column-major (Fortran-style):\n\t\t'column-major': 102\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumerated;\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/**\n* Return a list of BLAS memory layouts.\n*\n* @module @stdlib/blas-base-layouts\n*\n* @example\n* import layouts from '@stdlib/blas-base-layouts';\n*\n* var list = layouts();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport enumeration from './enum.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\n\n\n// EXPORTS //\n\nexport default main;\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// MODULES //\n\nimport DATA from './data.json';\n\n\n// MAIN //\n\n/**\n* Returns a list of BLAS memory layouts.\n*\n* @returns {StringArray} list of memory layouts\n*\n* @example\n* var list = layouts();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\nfunction layouts() {\n\treturn DATA.slice();\n}\n\n\n// EXPORTS //\n\nexport default layouts;\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 { enum as layouts } from '@stdlib/blas-base-layouts';\n\n\n// VARIABLES //\n\nvar LAYOUTS = layouts();\n\n\n// MAIN //\n\n/**\n* Returns an object mapping supported orders 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 == 1`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects.\n*\n* @returns {Object} object mapping supported orders to integer values\n*\n* @example\n* var table = enumerated();\n* // returns \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `orders.h` enumeration!!!!\n\treturn {\n\t\t// Row-major (C-style):\n\t\t'row-major': LAYOUTS[ 'row-major' ],\n\n\t\t// Column-major (Fortran-style):\n\t\t'column-major': LAYOUTS[ 'column-major' ]\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumerated;\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 list of ndarray orders.\n*\n* @module @stdlib/ndarray-orders\n*\n* @example\n* import orders from '@stdlib/ndarray-orders';\n*\n* var list = orders();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport enumeration from './enum.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\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 orders from '@stdlib/ndarray-orders';\n\n\n// VARIABLES //\n\nvar ORDERS = orders();\nvar len = ORDERS.length;\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is an ndarray order.\n*\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is an ndarray order\n*\n* @example\n* var bool = isOrder( 'row-major' );\n* // returns true\n*\n* bool = isOrder( 'column-major' );\n* // returns true\n*\n* bool = isOrder( 'foo' );\n* // returns false\n*/\nfunction isOrder( v ) {\n\tvar i;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( v === ORDERS[ i ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isOrder;\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 TYPE = 'function';\n\n\n// MAIN //\n\n/**\n* Tests if an array-like object supports the accessor (get/set) protocol.\n*\n* @param {Object} value - value to test\n* @returns {boolean} boolean indicating whether a value is an accessor array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var bool = isAccessorArray( new Complex128Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isAccessorArray( [] );\n* // returns false\n*/\nfunction isAccessorArray( value ) {\n\treturn ( typeof value.get === TYPE && typeof value.set === TYPE ); // eslint-disable-line valid-typeof\n}\n\n\n// EXPORTS //\n\nexport default isAccessorArray;\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 GETTERS = {\n\t'complex128': getComplex128,\n\t'complex64': getComplex64,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex128( arr, 1 );\n* // returns \n*\n* var re = real( v );\n* // returns 3.0\n*\n* var im = imag( v );\n* // returns 4.0\n*/\nfunction getComplex128( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex64( arr, 1 );\n* // returns \n*\n* var re = realf( v );\n* // returns 3.0\n*\n* var im = imagf( v );\n* // returns 4.0\n*/\nfunction getComplex64( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from an array-like object supporting the get/set protocol.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* function get( idx ) {\n* return arr[ idx ];\n* }\n*\n* function set( value, idx ) {\n* arr[ idx ] = value;\n* }\n*\n* arr.get = get;\n* arr.set = set;\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an array-like object supporting the get/set protocol.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 1 );\n* // returns \n*\n* var re = realf( v );\n* // returns 3.0\n*\n* var im = imagf( v );\n* // returns 4.0\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\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 GETTERS = {\n\t'float64': getFloat64,\n\t'float32': getFloat32,\n\t'int32': getInt32,\n\t'int16': getInt16,\n\t'int8': getInt8,\n\t'uint32': getUint32,\n\t'uint16': getUint16,\n\t'uint8': getUint8,\n\t'uint8c': getUint8c,\n\t'generic': getGeneric,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var arr = new Float64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat64( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat64( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float32Array from '@stdlib/array-float32';\n*\n* var arr = new Float32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat32( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat32( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int32Array from '@stdlib/array-int32';\n*\n* var arr = new Int32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt32( arr, 2 );\n* // returns 3\n*/\nfunction getInt32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int16Array from '@stdlib/array-int16';\n*\n* var arr = new Int16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt16( arr, 2 );\n* // returns 3\n*/\nfunction getInt16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int8Array from '@stdlib/array-int8';\n*\n* var arr = new Int8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt8( arr, 2 );\n* // returns 3\n*/\nfunction getInt8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint32Array from '@stdlib/array-uint32';\n*\n* var arr = new Uint32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint32( arr, 2 );\n* // returns 3\n*/\nfunction getUint32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint16Array from '@stdlib/array-uint16';\n*\n* var arr = new Uint16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint16( arr, 2 );\n* // returns 3\n*/\nfunction getUint16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var arr = new Uint8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8( arr, 2 );\n* // returns 3\n*/\nfunction getUint8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array-uint8c';\n*\n* var arr = new Uint8ClampedArray( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8c( arr, 2 );\n* // returns 3\n*/\nfunction getUint8c( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a generic `Array`.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getGeneric( arr, 2 );\n* // returns 3\n*/\nfunction getGeneric( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an indexed array-like object.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an indexed array-like object.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 2 );\n* // returns 3\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\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// Mapping from array constructors to data types...\nvar ctor2dtypes = {\n\t'Float32Array': 'float32',\n\t'Float64Array': 'float64',\n\t'Array': 'generic',\n\t'Int16Array': 'int16',\n\t'Int32Array': 'int32',\n\t'Int8Array': 'int8',\n\t'Uint16Array': 'uint16',\n\t'Uint32Array': 'uint32',\n\t'Uint8Array': 'uint8',\n\t'Uint8ClampedArray': 'uint8c',\n\t'Complex64Array': 'complex64',\n\t'Complex128Array': 'complex128'\n};\n\n\n// EXPORTS //\n\nexport default ctor2dtypes;\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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* import ctor from '@stdlib/array-float64';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat64ArraySupport from '@stdlib/assert-has-float64array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat64Array;\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 main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isFloat64Array from '@stdlib/assert-is-float64array';\nimport GlobalFloat64Array from './float64array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasFloat64ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* import ctor from '@stdlib/array-float32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat32ArraySupport from '@stdlib/assert-has-float32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat32Array;\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 main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isFloat32Array from '@stdlib/assert-is-float32array';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport GlobalFloat32Array from './float32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasFloat32ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* import ctor from '@stdlib/array-uint32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint32ArraySupport from '@stdlib/assert-has-uint32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint32Array;\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 unsigned 32-bit integer.\n*\n* @module @stdlib/constants-uint32-max\n* @type {uinteger32}\n*\n* @example\n* import UINT32_MAX from '@stdlib/constants-uint32-max';\n* // returns 4294967295\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar UINT32_MAX = 4294967295;\n\n\n// EXPORTS //\n\nexport default UINT32_MAX;\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 main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint32Array from '@stdlib/assert-is-uint32array';\nimport UINT32_MAX from '@stdlib/constants-uint32-max';\nimport GlobalUint32Array from './uint32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint32ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* import ctor from '@stdlib/array-int32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt32ArraySupport from '@stdlib/assert-has-int32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt32Array;\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 main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isInt32Array from '@stdlib/assert-is-int32array';\nimport INT32_MAX from '@stdlib/constants-int32-max';\nimport INT32_MIN from '@stdlib/constants-int32-min';\nimport GlobalInt32Array from './int32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt32ArraySupport;\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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* import INT32_MIN from '@stdlib/constants-int32-min';\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT32_MIN;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* import ctor from '@stdlib/array-uint16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint16ArraySupport from '@stdlib/assert-has-uint16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint16Array;\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 main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint16Array from '@stdlib/assert-is-uint16array';\nimport UINT16_MAX from '@stdlib/constants-uint16-max';\nimport GlobalUint16Array from './uint16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint16ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* import ctor from '@stdlib/array-int16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt16ArraySupport from '@stdlib/assert-has-int16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt16Array;\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 main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isInt16Array from '@stdlib/assert-is-int16array';\nimport INT16_MAX from '@stdlib/constants-int16-max';\nimport INT16_MIN from '@stdlib/constants-int16-min';\nimport GlobalInt16Array from './int16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt16ArraySupport;\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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* import INT16_MIN from '@stdlib/constants-int16-min';\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT16_MIN;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* import ctor from '@stdlib/array-uint8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ArraySupport from '@stdlib/assert-has-uint8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8Array;\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 main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint8Array from '@stdlib/assert-is-uint8array';\nimport UINT8_MAX from '@stdlib/constants-uint8-max';\nimport GlobalUint8Array from './uint8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* import ctor from '@stdlib/array-uint8c';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ClampedArraySupport from '@stdlib/assert-has-uint8clampedarray-support'; // eslint-disable-line id-length\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8ClampedArray;\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 main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint8ClampedArray from '@stdlib/assert-is-uint8clampedarray';\nimport GlobalUint8ClampedArray from './uint8clampedarray.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ClampedArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\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 main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 an array-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is an array-like object\n*\n* @example\n* var bool = isArrayLikeObject( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( { 'length':10 } );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( 'beep' );\n* // returns false\n*/\nfunction isArrayLikeObject( 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 isArrayLikeObject;\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 hasArrayBuffer = ( typeof ArrayBuffer === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an ArrayBuffer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an ArrayBuffer\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var bool = isArrayBuffer( new ArrayBuffer( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isArrayBuffer( [] );\n* // returns false\n*/\nfunction isArrayBuffer( value ) {\n\treturn (\n\t\t( hasArrayBuffer && value instanceof ArrayBuffer ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object ArrayBuffer]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArrayBuffer;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObject;\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 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' );\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'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nexport default valueOf;\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 test from './try2valueof.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\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 String]' );\n\t}\n\treturn false;\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'use strict';\n\n// MODULES //\n\nimport valueOf from './valueof.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.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 string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\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'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 128-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex128} 128-bit complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex128( real, imag ) {\n\tif ( !( this instanceof Complex128 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': real\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': imag\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex128.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 16\n*/\nsetReadOnly( Complex128.prototype, 'byteLength', 16 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex128.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.\n*\n* @name toJSON\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex128.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex128;\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 string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* import isString from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* import { isObject as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* import { isPrimitive as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex128';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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 fround = ( typeof Math.fround === 'function' ) ? Math.fround : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default fround;\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 Float32Array from '@stdlib/array-float32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest single-precision floating-point number\n*\n* @example\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\nfunction float64ToFloat32( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn FLOAT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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* Convert a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @module @stdlib/number-float64-base-to-float32\n*\n* @example\n* import float64ToFloat32 from '@stdlib/number-float64-base-to-float32';\n*\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar float64ToFloat32;\nif ( typeof builtin === 'function' ) {\n\tfloat64ToFloat32 = builtin;\n} else {\n\tfloat64ToFloat32 = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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 defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport float64ToFloat32 from '@stdlib/number-float64-base-to-float32';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( real )\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( imag )\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex64;\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 Complex128 from '@stdlib/complex-float64-ctor';\nimport Complex64 from '@stdlib/complex-float32-ctor';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a complex number-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex number-like object.\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n*\n* var x = new Complex128( 4.0, 2.0 );\n* var bool = isComplexLike( x );\n* // returns true\n*\n* x = new Complex64( 4.0, 2.0 );\n* bool = isComplexLike( x );\n* // returns true\n*/\nfunction isComplexLike( value ) {\n\tif ( value instanceof Complex128 || value instanceof Complex64 ) {\n\t\treturn true;\n\t}\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.re === 'number' &&\n\t\ttypeof value.im === 'number'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplexLike;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a finite numeric value is an even number.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an even number\n*\n* @example\n* var bool = isEven( 5.0 );\n* // returns false\n*\n* @example\n* var bool = isEven( -2.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( 0.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( NaN );\n* // returns false\n*/\nfunction isEven( x ) {\n\treturn isInteger( x/2.0 );\n}\n\n\n// EXPORTS //\n\nexport default isEven;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 8; // 4 bytes per float32 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex64Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex64Array`\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n*\n* var bool = isComplex64Array( new Complex64Array( 10 ) );\n* // returns true\n*\n* bool = isComplex64Array( [] );\n* // returns false\n*/\nfunction isComplex64Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex64Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex64array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex64Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex64Array;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 16; // 8 bytes per float64 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex128Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex128Array`\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var bool = isComplex128Array( new Complex128Array( 10 ) );\n* // returns true\n*\n* bool = isComplex128Array( [] );\n* // returns false\n*/\nfunction isComplex128Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex128Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex128array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex128Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex128Array;\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 Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.iterator` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.iterator` support\n*\n* @example\n* var bool = hasIteratorSymbolSupport();\n* // returns \n*/\nfunction hasIteratorSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol' &&\n\t\thasOwnProp( Symbol, 'iterator' ) &&\n\t\ttypeof Symbol.iterator === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasIteratorSymbolSupport;\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 hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\n\n\n// MAIN //\n\n/**\n* Iterator symbol.\n*\n* @name IteratorSymbol\n* @constant\n* @type {(symbol|null)}\n*\n* @example\n* function iterator() {\n* var it;\n* var i;\n*\n* i = -1;\n*\n* it = {};\n* it.next = next;\n* it.return = done;\n*\n* if ( IteratorSymbol ) {\n* it[ IteratorSymbol ] = iterator;\n* }\n* return it;\n*\n* function next() {\n* i += 1;\n* return {\n* 'value': i,\n* 'done': false\n* };\n* }\n*\n* function done( value ) {\n* if ( arguments.length === 0 ) {\n* return {\n* 'done': true\n* };\n* }\n* return {\n* 'value': value,\n* 'done': true\n* };\n* }\n* }\n*\n* var obj = iterator();\n*/\nvar IteratorSymbol = ( hasIteratorSymbolSupport() ) ? Symbol.iterator : null;\n\n\n// EXPORTS //\n\nexport default IteratorSymbol;\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 accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - accessor\n*\n* @example\n* function getter() {\n* return 'bar';\n* }\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnlyAccessor( obj, 'foo', getter );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnlyAccessor( obj, prop, getter ) { // eslint-disable-line id-length\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'get': getter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnlyAccessor;\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 defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport float64ToFloat32 from '@stdlib/number-float64-base-to-float32';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( real )\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( imag )\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex64;\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* Returns the real component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var re = realf( z );\n* // returns 5.0\n*/\nfunction realf( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default realf;\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* Returns the imaginary component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var im = imagf( z );\n* // returns 3.0\n*/\nfunction imagf( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imagf;\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 Float32Array from '@stdlib/array-float32';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex64Array` as a `Float32Array`.\n*\n* @param {Complex64Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float32Array} `Float32Array` view\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n*\n* var x = new Complex64Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 Float64Array from '@stdlib/array-float64';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex128Array` as a `Float64Array`.\n*\n* @param {Complex128Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float64Array} `Float64Array` view\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var x = new Complex128Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isCollection from '@stdlib/assert-is-collection';\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport isObject from '@stdlib/assert-is-object';\nimport isArray from '@stdlib/assert-is-array';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isEven from '@stdlib/math-base-assert-is-even';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\nimport ITERATOR_SYMBOL from '@stdlib/symbol-iterator';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport Float32Array from '@stdlib/array-float32';\nimport Complex64 from '@stdlib/complex-float32';\nimport format from '@stdlib/string-format';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\nimport floor from '@stdlib/math-base-special-floor';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport getter from '@stdlib/array-base-getter';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\nimport fromArray from './from_array.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Float32Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex64Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex64Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex128Array...\n\t\tvalue.name === 'Complex128Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float32Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex64} complex number\n*/\nfunction getComplex64( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex64( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 64-bit complex number array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {RangeError} ArrayBuffer byte length must be a multiple of `8`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} byte offset must be a multiple of `8`\n* @throws {TypeError} view length must be a positive multiple of `8`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} complex number array\n*\n* @example\n* var arr = new Complex64Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex64Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex64Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Complex64Array( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Complex64Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex64Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex64Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex64Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex64Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex64Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex64Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex64Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float32Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float32Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float32Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float32Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float32Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) ); // FIXME: `buf` is what is returned from above, NOT the original value\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arguments[0] ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64Array\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var nbytes = Complex64Array.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex64Array\n* @readonly\n* @type {string}\n* @default 'Complex64Array'\n*\n* @example\n* var str = Complex64Array.name;\n* // returns 'Complex64Array'\n*/\nsetReadOnly( Complex64Array, 'name', 'Complex64Array' );\n\n/**\n* Creates a new 64-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex64Array\n* @type {Function}\n* @param {(Collection|Iterable)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function clbk( v ) {\n* return new Complex64( realf(v)*2.0, imagf(v)*2.0 );\n* }\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex64Array, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.', 2, len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n});\n\n/**\n* Creates a new 64-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex64Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex64Array, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var z = arr.at( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 0.0\n*\n* var im = imagf( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns -1.0\n*\n* z = arr.at( -1 );\n* // returns \n*\n* re = realf( z );\n* // returns 9.0\n*\n* im = imagf( z );\n* // returns -9.0\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex64( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 80\n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array.prototype, 'BYTES_PER_ELEMENT', Complex64Array.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} modified array\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex64( 1.0, 1.0 ), 0 );\n* arr.set( new Complex64( 2.0, 2.0 ), 1 );\n* arr.set( new Complex64( 3.0, 3.0 ), 2 );\n* arr.set( new Complex64( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* // Get the last array element:\n* var z = arr.get( 3 );\n*\n* var re = realf( z );\n* // returns 2.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex64Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*2 );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = [\n* new Complex64( 1.0, 1.0 ),\n* new Complex64( 2.0, 2.0 ),\n* new Complex64( 3.0, 3.0 )\n* ];\n* arr = new Complex64Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'entries', function entries() {\n\tvar buffer;\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tself = this;\n\tbuffer = this._buffer;\n\tlen = this._length;\n\n\t// Initialize the iteration indices:\n\ti = -1;\n\tj = -2;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\tvar z;\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj += 2;\n\t\tz = new Complex64( buffer[ j ], buffer[ j+1 ] );\n\t\treturn {\n\t\t\t'value': [ i, z ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, getComplex64( buf, i ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.fill( new Complex64( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 1.0\n*\n* z = arr.get( 1 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tre = realf( value );\n\tim = imagf( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 1\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 2.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex64Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import Complex64 from '@stdlib/complex-float32';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex64Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import Complex64 from '@stdlib/complex-float32';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns \n*\n* var re = realf( z );\n* // returns 3.0\n*\n* var im = imagf( z );\n* // returns 3.0\n*/\nsetReadOnly( Complex64Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex64Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 0.0\n*\n* var im = imagf( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns -1.0\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex64( this._buffer, idx );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex64( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex64( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex64( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 10 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex64( 4.0, -4.0 ), -3 );\n* // returns -1\n*/\nsetReadOnly( Complex64Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex64( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function scale( v, i ) {\n* return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 2\n*\n* var im = imagf( z );\n* // returns -2\n*/\nsetReadOnly( Complex64Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = fcn.call( thisArg, getComplex64( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = realf( v );\n\t\t\toutbuf[ (2*i)+1 ] = imagf( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import caddf from '@stdlib/math-base-ops-caddf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( caddf );\n* // returns \n*\n* var re = realf( z );\n* // returns 6.0\n*\n* var im = imagf( z );\n* // returns 6.0\n*/\nsetReadOnly( Complex64Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = getComplex64( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex64( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 3.0\n*\n* var im = imagf( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n*\n* @name set\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 0.0\n*\n* var im = imagf( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns -1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = realf( value );\n\t\tbuf[ idx+1 ] = imagf( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( value ) ) {\n\t\tN = value._length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tsbuf = value._buffer;\n\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Float32Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float32Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = realf( v );\n\t\t\tbuf[ idx+1 ] = imagf( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns -1.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 5.0\n*\n* im = imagf( z );\n* // returns -5.0\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* z = out.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns -2.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 3.0\n*\n* im = imagf( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex64Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( start < end ) {\n\t\toutlen = end - start;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, getComplex64( buf, i ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var z = subarr.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns -1.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 5.0\n*\n* im = imagf( z );\n* // returns -5.0\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* z = subarr.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns -2.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 3.0\n*\n* im = imagf( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex64Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + (begin*BYTES_PER_ELEMENT);\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 3.0\n*\n* var im = imagf( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a complex number\n* @returns {Complex64Array} new typed array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex64( 4.0, 4.0 ) );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 4.0\n*\n* var im = imagf( z );\n* // returns 4.0\n*/\nsetReadOnly( Complex64Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = realf( value );\n\tbuf[ (2*index)+1 ] = imagf( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex64Array;\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 isComplexLike from '@stdlib/assert-is-complex-like';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float32Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float32Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = realf( v );\n\t\tbuf[ j+1 ] = imagf( v );\n\t\tj += 2; // stride\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\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 defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 128-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex128} 128-bit complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex128( real, imag ) {\n\tif ( !( this instanceof Complex128 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': real\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': imag\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex128.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 16\n*/\nsetReadOnly( Complex128.prototype, 'byteLength', 16 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex128.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.\n*\n* @name toJSON\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex128.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex128;\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* Returns the real component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport format from '@stdlib/string-format';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex128';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isCollection from '@stdlib/assert-is-collection';\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport isObject from '@stdlib/assert-is-object';\nimport isArray from '@stdlib/assert-is-array';\nimport isString from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isEven from '@stdlib/math-base-assert-is-even';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\nimport ITERATOR_SYMBOL from '@stdlib/symbol-iterator';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport Float64Array from '@stdlib/array-float64';\nimport Complex128 from '@stdlib/complex-float64';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\nimport floor from '@stdlib/math-base-special-floor';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport getter from '@stdlib/array-base-getter';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport format from '@stdlib/string-format';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\nimport fromArray from './from_array.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Float64Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex128Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex128Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex64Array...\n\t\tvalue.name === 'Complex64Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float64Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex128} complex number\n*/\nfunction getComplex128( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex128( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 128-bit complex number array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {RangeError} ArrayBuffer byte length must be a multiple of `16`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} byte offset must be a multiple of `16`\n* @throws {TypeError} view length must be a positive multiple of `16`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} complex number array\n*\n* @example\n* var arr = new Complex128Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex128Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex128Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex128Array( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex128Array( buf, 16 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = new Complex128Array( buf, 16, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex128Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex128Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex128Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex128Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex128Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex128Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float64Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float64Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float64Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float64Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float64Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arguments[0] ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128Array\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var nbytes = Complex128Array.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex128Array\n* @readonly\n* @type {string}\n* @default 'Complex128Array'\n*\n* @example\n* var name = Complex128Array.name;\n* // returns 'Complex128Array'\n*/\nsetReadOnly( Complex128Array, 'name', 'Complex128Array' );\n\n/**\n* Creates a new 128-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex128Array\n* @type {Function}\n* @param {(Collection|Object)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function clbk( v ) {\n* return new Complex128( real(v)*2.0, imag(v)*2.0 );\n* }\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex128Array, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n});\n\n/**\n* Creates a new 128-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex128Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex128Array, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.at( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 0.0\n*\n* var im = imag( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns -1.0\n*\n* z = arr.at( -1 );\n* // returns \n*\n* re = real( z );\n* // returns 9.0\n*\n* im = imag( z );\n* // returns -9.0\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex128( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 160\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array.prototype, 'BYTES_PER_ELEMENT', Complex128Array.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} modified array\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex128( 1.0, 1.0 ), 0 );\n* arr.set( new Complex128( 2.0, 2.0 ), 1 );\n* arr.set( new Complex128( 3.0, 3.0 ), 2 );\n* arr.set( new Complex128( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* // Get the last array element:\n* var z = arr.get( 3 );\n*\n* var re = real( z );\n* // returns 2.0\n*\n* var im = imag( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex128Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*2 );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = [\n* new Complex128( 1.0, 1.0 ),\n* new Complex128( 2.0, 2.0 ),\n* new Complex128( 3.0, 3.0 )\n* ];\n* arr = new Complex128Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'entries', function entries() {\n\tvar buffer;\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tself = this;\n\tbuffer = this._buffer;\n\tlen = this._length;\n\n\t// Initialize the iteration indices:\n\ti = -1;\n\tj = -2;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\tvar z;\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj += 2;\n\t\tz = new Complex128( buffer[ j ], buffer[ j+1 ] );\n\t\treturn {\n\t\t\t'value': [ i, z ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, getComplex128( buf, i ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.fill( new Complex128( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns 1.0\n*\n* z = arr.get( 1 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tre = real( value );\n\tim = imag( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 1\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 2.0\n*\n* var im = imag( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex128Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex128Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns \n*\n* var re = real( z );\n* // returns 3.0\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nsetReadOnly( Complex128Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex128Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* var arr = new Complex128Array( 10 );\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 0.0\n*\n* var im = imag( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns -1.0\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex128( this._buffer, idx );\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex128( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex128( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex128( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex128( 4.0, -4.0 ), -3 );\n* // returns 3\n*/\nsetReadOnly( Complex128Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex128( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex128( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function scale( v, i ) {\n* return new Complex128( 2.0*real( v ), 2.0*imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 2.0\n*\n* var im = imag( z );\n* // returns -2.0\n*/\nsetReadOnly( Complex128Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = fcn.call( thisArg, getComplex128( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = real( v );\n\t\t\toutbuf[ (2*i)+1 ] = imag( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n* import cadd from '@stdlib/math-base-ops-cadd';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( cadd );\n* // returns \n*\n* var re = real( z );\n* // returns 6.0\n*\n* var im = imag( z );\n* // returns 6.0\n*/\nsetReadOnly( Complex128Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = getComplex128( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex128( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 3.0\n*\n* var im = imag( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values as intended.\n*\n* @name set\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 0.0\n*\n* var im = imag( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns -1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = real( value );\n\t\tbuf[ idx+1 ] = imag( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( value ) ) {\n\t\tN = value._length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tsbuf = value._buffer;\n\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Float64Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float64Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = real( v );\n\t\t\tbuf[ idx+1 ] = imag( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns -1.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 5.0\n*\n* im = imag( z );\n* // returns -5.0\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* z = out.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns -2.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 3.0\n*\n* im = imag( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex128Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( start < end ) {\n\t\toutlen = end - start;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, getComplex128( buf, i ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var z = subarr.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns -1.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 5.0\n*\n* im = imag( z );\n* // returns -5.0\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* z = subarr.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns -2.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 3.0\n*\n* im = imag( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex128Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 3.0\n*\n* var im = imag( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a complex number\n* @returns {Complex128Array} new typed array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex128( 4.0, 4.0 ) );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 4.0\n*\n* var im = imag( z );\n* // returns 4.0\n*/\nsetReadOnly( Complex128Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = real( value );\n\tbuf[ (2*index)+1 ] = imag( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex128Array;\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 isComplexLike from '@stdlib/assert-is-complex-like';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float64Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float64Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = real( v );\n\t\tbuf[ j+1 ] = imag( v );\n\t\tj += 2; // stride\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport format from '@stdlib/string-format';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\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 Float64Array from '@stdlib/array-float64';\nimport Float32Array from '@stdlib/array-float32';\nimport Uint32Array from '@stdlib/array-uint32';\nimport Int32Array from '@stdlib/array-int32';\nimport Uint16Array from '@stdlib/array-uint16';\nimport Int16Array from '@stdlib/array-int16';\nimport Uint8Array from '@stdlib/array-uint8';\nimport Uint8ClampedArray from '@stdlib/array-uint8c';\nimport Int8Array from '@stdlib/array-int8';\nimport Complex64Array from '@stdlib/array-complex64';\nimport Complex128Array from '@stdlib/array-complex128';\n\n\n// MAIN //\n\n// Note: order should match `dtypes` order\nvar CTORS = [\n\tFloat64Array,\n\tFloat32Array,\n\tInt32Array,\n\tUint32Array,\n\tInt16Array,\n\tUint16Array,\n\tInt8Array,\n\tUint8Array,\n\tUint8ClampedArray,\n\tComplex64Array,\n\tComplex128Array\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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// Note: order should match `ctors` order\nvar DTYPES = [\n\t'float64',\n\t'float32',\n\t'int32',\n\t'uint32',\n\t'int16',\n\t'uint16',\n\t'int8',\n\t'uint8',\n\t'uint8c',\n\t'complex64',\n\t'complex128'\n];\n\n\n// EXPORTS //\n\nexport default DTYPES;\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 isBuffer from '@stdlib/assert-is-buffer';\nimport isArray from '@stdlib/assert-is-array';\nimport constructorName from '@stdlib/utils-constructor-name';\nimport ctor2dtype from './ctor2dtype.js';\nimport CTORS from './ctors.js';\nimport DTYPES from './dtypes.js';\n\n\n// VARIABLES //\n\nvar NTYPES = DTYPES.length;\n\n\n// MAIN //\n\n/**\n* Returns the data type of an array.\n*\n* @param {*} value - input value\n* @returns {(string|null)} data type\n*\n* @example\n* var dt = dtype( [ 1, 2, 3 ] );\n* // returns 'generic'\n*\n* var dt = dtype( 'beep' );\n* // returns null\n*/\nfunction dtype( value ) {\n\tvar i;\n\tif ( isArray( value ) ) {\n\t\treturn 'generic';\n\t}\n\tif ( isBuffer( value ) ) {\n\t\treturn null;\n\t}\n\tfor ( i = 0; i < NTYPES; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn DTYPES[ i ];\n\t\t}\n\t}\n\t// If the above failed, fall back to a more robust (and significantly slower) means for resolving underlying data types:\n\treturn ctor2dtype[ constructorName( value ) ] || null;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isCollection from '@stdlib/assert-is-collection';\nimport isAccessorArray from '@stdlib/array-base-assert-is-accessor-array';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport dtype from '@stdlib/array-dtype';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function to tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @throws {TypeError} must provide an array-like object\n* @returns {Function} function to test if an array contains a search value\n*\n* @example\n* var contains = factory( [ 1, 2, 3 ] );\n* // returns \n*\n* var bool = contains( 2 );\n* // returns true\n*/\nfunction factory( x ) {\n\tvar get;\n\tvar len;\n\tvar dt;\n\n\tif ( !isCollection( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', x ) );\n\t}\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\treturn ( get === void 0 ) ? contains : accessors;\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*\n\t* @example\n\t* var out = contains( [ 1, 2, 3 ], 2 );\n\t* // returns true\n\t*/\n\tfunction contains( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( x[ i ] === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*/\n\tfunction accessors( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( get( x, i ) === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\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* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {RegExp} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string-base-capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 an array contains a provided search value.\n*\n* @module @stdlib/array-base-assert-contains\n*\n* @example\n* import contains from '@stdlib/array-base-assert-contains';\n*\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"factory\": \"main.factory\" }\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isAccessorArray from '@stdlib/array-base-assert-is-accessor-array';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport getter from '@stdlib/array-base-getter';\nimport dtype from '@stdlib/array-dtype';\n\n\n// MAIN //\n\n/**\n* Tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @param {*} value - search value\n* @returns {boolean} boolean indicating if an array contains a search value\n*\n* @example\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\nfunction contains( x, value ) {\n\tvar len;\n\tvar get;\n\tvar dt;\n\tvar i;\n\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t} else {\n\t\tget = getter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\t// Loop over the elements...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( get( x, i ) === value ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default contains;\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 replace from '@stdlib/string-base-replace';\nimport DTYPES from './dtypes.json';\n\n\n// VARIABLES //\n\nvar RE_SUFFIX = /_and_generic$/;\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray data types.\n*\n* @param {string} [kind] - data type kind\n* @returns {StringArray} list of ndarray data types\n*\n* @example\n* var list = dtypes();\n* // returns [...]\n*\n* @example\n* var list = dtypes( 'floating_point' );\n* // returns [...]\n*/\nfunction dtypes() {\n\tvar kind;\n\tvar out;\n\tvar FLG;\n\tif ( arguments.length === 0 ) {\n\t\treturn DTYPES.all.slice();\n\t}\n\tFLG = false;\n\tkind = arguments[ 0 ];\n\tif ( RE_SUFFIX.test( kind ) ) {\n\t\tkind = replace( kind, RE_SUFFIX, '' );\n\t\tif ( kind !== 'all' ) {\n\t\t\tFLG = true;\n\t\t}\n\t}\n\tout = DTYPES[ kind ];\n\tout = ( out ) ? out.slice() : [];\n\tif ( FLG && out.length > 0 ) {\n\t\tout.push( 'generic' );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default dtypes;\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/* eslint-disable stdlib/empty-line-before-comment */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns an object mapping supported data type strings to enumeration constants.\n*\n* ## Notes\n*\n* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `INT8 == 0`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects. While certain dtypes, such as \"generic\" and \"binary\", have special behavior in JavaScript, they do not have a direct complement in C.\n*\n* @private\n* @returns {Object} object mapping supported dtypes to enumeration constants\n*\n* @example\n* var table = enumeration();\n* // returns \n*/\nfunction enumeration() {\n\t// NOTE: the following should match the C `dtypes.h` enumeration!!!!\n\treturn {\n\t\t// Boolean data types:\n\t\t'bool': 0,\n\n\t\t// Integer data types:\n\t\t'int8': 1,\n\t\t'uint8': 2,\n\t\t'uint8c': 3,\n\t\t'int16': 4,\n\t\t'uint16': 5,\n\t\t'int32': 6,\n\t\t'uint32': 7,\n\t\t'int64': 8,\n\t\t'uint64': 9,\n\t\t// 'int128': 10, // uncomment once supported\n\t\t// 'uint128': 11,\n\t\t// 'int256': 12,\n\t\t// 'uint256': 13,\n\n\t\t// Floating-point data types:\n\t\t// 'float16': 14,\n\t\t// 'bfloat16': 15,\n\t\t'float32': 10,\n\t\t'float64': 11,\n\t\t// 'float128': 18, // uncomment once supported\n\n\t\t// Complex floating-point number data types:\n\t\t'complex64': 12,\n\t\t'complex128': 13,\n\n\t\t// Data type for \"binary\" data (i.e., data stored in a Node.js `Buffer` object):\n\t\t'binary': 14,\n\n\t\t// Data type for \"generic\" JavaScript values (objects):\n\t\t'generic': 15,\n\n\t\t// Define a signaling value which is guaranteed not to be a valid type enumeration value:\n\t\t'notype': 17,\n\n\t\t// Indicate the start of user defined type numbers (leaving room for type growth above):\n\t\t'userdefined_type': 256\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumeration;\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 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* setReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setReadOnly;\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 an array of an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 bool = ( typeof Object.keys !== 'undefined' );\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// MODULES //\n\nimport isArguments from './main.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\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 if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 isNan from '@stdlib/math-base-assert-is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 isNan from '@stdlib/math-base-assert-is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* import isnan from '@stdlib/assert-is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isnan } from '@stdlib/assert-is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* import { isObject as isnan } from '@stdlib/assert-is-nan';\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\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\n/**\n* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\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 isEnum from './native.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\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// MODULES //\n\nimport isString from '@stdlib/assert-is-string';\nimport { isPrimitive as isnan } from '@stdlib/assert-is-nan';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport isEnum from './native.js';\nimport hasStringEnumBug from './has_string_enumerability_bug.js';\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\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 `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* import isArguments from '@stdlib/assert-is-arguments';\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nimport hasArgumentsClass from './detect.js';\nimport main from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport isArray from '@stdlib/assert-is-array';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-uint32-max';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\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 isArguments from '@stdlib/assert-is-arguments';\nimport builtin from './builtin.js';\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport noop from '@stdlib/utils-noop';\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\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/**\n* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nexport default noop;\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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\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// MODULES //\n\nimport isnan from '@stdlib/assert-is-nan';\nimport isCollection from '@stdlib/assert-is-collection';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} third argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', arr ) );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nexport default indexOf;\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 whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nexport default isConstructorPrototype;\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 hasArgumentsBug from './has_arguments_bug.js';\nimport HAS_BUILTIN from './has_builtin.js';\nimport builtin from './builtin.js';\nimport wrapper from './builtin_wrapper.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nexport default w;\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 indexOf from '@stdlib/utils-index-of';\nimport typeOf from '@stdlib/utils-type-of';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport EXCLUDED_KEYS from './excluded_keys.json';\nimport win from './window.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\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// MAIN //\n\nvar bool = ( typeof window !== 'undefined' );\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// MODULES //\n\nimport keys from './builtin.js';\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\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 isObjectLike from '@stdlib/assert-is-object-like';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isArguments from '@stdlib/assert-is-arguments';\nimport HAS_ENUM_PROTO_BUG from './has_enumerable_prototype_bug.js';\nimport HAS_NON_ENUM_PROPS_BUG from './has_non_enumerable_properties_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype_wrapper.js';\nimport NON_ENUMERABLE from './non_enumerable.json';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 hasAutomationEqualityBug from './has_automation_equality_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport HAS_WINDOW from './has_window.js';\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default wrapper;\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 list of ndarray data types.\n*\n* @module @stdlib/ndarray-dtypes\n*\n* @example\n* import dtypes from '@stdlib/ndarray-dtypes';\n*\n* var list = dtypes();\n* // returns [...]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport enumeration from './enum.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\nassign( main, enumeration() );\n\n\n// EXPORTS //\n\nexport default main;\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 setReadOnly from '@stdlib/utils-define-read-only-property';\nimport objectKeys from '@stdlib/utils-keys';\n\n\n// MAIN //\n\n/**\n* Copies all enumerable own properties from a source object to a target object as enumerable read-only properties.\n*\n* @private\n* @param {Object} target - target object\n* @param {Object} source - source object\n* @returns {Object} modified target object\n*\n* @example\n* var source = {\n* 'beep': 'boop'\n* };\n* var target = {};\n*\n* var out = assign( target, source );\n* // returns \n*\n* var bool = ( out === target );\n* // returns true\n*\n* var v = target.beep;\n* // returns 'boop'\n*/\nfunction assign( target, source ) {\n\tvar keys;\n\tvar k;\n\tvar i;\n\n\tkeys = objectKeys( source );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tk = keys[ i ];\n\t\tsetReadOnly( target, k, source[ k ] );\n\t}\n\treturn target;\n}\n\n\n// EXPORTS //\n\nexport default assign;\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 { factory as contains } from '@stdlib/array-base-assert-contains';\nimport dtypes from '@stdlib/ndarray-dtypes';\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is a supported ndarray data type.\n*\n* @name isDataType\n* @type {Function}\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is a supported ndarray data type\n*\n* @example\n* var bool = isDataType( 'binary' );\n* // returns true\n*\n* bool = isDataType( 'float32' );\n* // returns true\n*\n* bool = isDataType( 'float64' );\n* // returns true\n*\n* bool = isDataType( 'generic' );\n* // returns true\n*\n* bool = isDataType( 'int16' );\n* // returns true\n*\n* bool = isDataType( 'int32' );\n* // returns true\n*\n* bool = isDataType( 'int8' );\n* // returns true\n*\n* bool = isDataType( 'uint16' );\n* // returns true\n*\n* bool = isDataType( 'uint32' );\n* // returns true\n*\n* bool = isDataType( 'uint8' );\n* // returns true\n*\n* bool = isDataType( 'uint8c' );\n* // returns true\n*\n* bool = isDataType( 'foo' );\n* // returns false\n*/\nvar isDataType = contains( dtypes() );\n\n\n// EXPORTS //\n\nexport default isDataType;\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* Computes the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @returns {Array} linear indices\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 10, 1 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -10, -1 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 1, 10 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -1, -10 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*/\nfunction minmaxViewBufferIndex( shape, strides, offset ) {\n\tvar ndims;\n\tvar min;\n\tvar max;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tmin = offset;\n\tmax = offset;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( shape[ i ] === 0 ) {\n\t\t\treturn [ offset, offset ];\n\t\t}\n\t\ts = strides[ i ];\n\t\tif ( s > 0 ) {\n\t\t\tmax += s * ( shape[i]-1 );\n\t\t} else if ( s < 0 ) {\n\t\t\tmin += s * ( shape[i]-1 ); // decrements min\n\t\t}\n\t}\n\treturn [ min, max ];\n}\n\n\n// EXPORTS //\n\nexport default minmaxViewBufferIndex;\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* Compute the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view.\n*\n* @module @stdlib/ndarray-base-minmax-view-buffer-index\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ 10, 1 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ -10, -1 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ 1, 10 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ -1, -10 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\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* Computes the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view and assigns results to a provided output array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} linear indices\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 10, 1 ];\n* var offset = 10;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 10, 109 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -10, -1 ];\n* var offset = 99;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 0, 99 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 1, 10 ];\n* var offset = 10;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 10, 109 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -1, -10 ];\n* var offset = 99;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 0, 99 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*/\nfunction minmaxViewBufferIndex( shape, strides, offset, out ) {\n\tvar ndims;\n\tvar min;\n\tvar max;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tmin = offset;\n\tmax = offset;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( shape[ i ] === 0 ) {\n\t\t\tout[ 0 ] = offset;\n\t\t\tout[ 1 ] = offset;\n\t\t\treturn out;\n\t\t}\n\t\ts = strides[ i ];\n\t\tif ( s > 0 ) {\n\t\t\tmax += s * ( shape[i]-1 );\n\t\t} else if ( s < 0 ) {\n\t\t\tmin += s * ( shape[i]-1 ); // decrements min\n\t\t}\n\t}\n\tout[ 0 ] = min;\n\tout[ 1 ] = max;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default minmaxViewBufferIndex;\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 getGlobal from '@stdlib/utils-global';\n\n\n// VARIABLES //\n\nvar Global = getGlobal();\n\n\n// MAIN //\n\n/**\n* Tests for native `BigInt` support.\n*\n* @returns {boolean} boolean indicating if an environment has `BigInt` support\n*\n* @example\n* var bool = hasBigIntSupport();\n* // returns \n*/\nfunction hasBigIntSupport() {\n\treturn (\n\t\ttypeof Global.BigInt === 'function' &&\n\t\ttypeof BigInt === 'function' && // eslint-disable-line stdlib/require-globals\n\t\ttypeof Global.BigInt( '1' ) === 'bigint' &&\n\t\ttypeof BigInt( '1' ) === 'bigint' // eslint-disable-line stdlib/require-globals, no-undef\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasBigIntSupport;\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* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\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* Determines if an array is column-major contiguous.\n*\n* @private\n* @param {integer} order - **inferred** array order\n* @param {boolean} contiguous - boolean indicating is an array is contiguous\n* @returns {boolean} boolean indicating if an array is column-major contiguous\n*/\nfunction isColumnMajorContiguous( order, contiguous ) {\n\treturn contiguous && ( order === 2 || order === 3 );\n}\n\n\n// EXPORTS //\n\nexport default isColumnMajorContiguous;\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* Determines if an array is row-major contiguous.\n*\n* @private\n* @param {integer} order - **inferred** array order\n* @param {boolean} contiguous - boolean indicating is an array is contiguous\n* @returns {boolean} boolean indicating if an array is row-major contiguous\n*/\nfunction isRowMajorContiguous( order, contiguous ) {\n\treturn contiguous && ( order === 1 || order === 3 );\n}\n\n\n// EXPORTS //\n\nexport default isRowMajorContiguous;\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* Returns the real component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a regular expression string. Value: `%s`.', str ) );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default rescape;\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 exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nexport default exec;\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 test from './try2exec.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\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 RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isRegExp;\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 exec from './exec.js';\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.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 rescape from '@stdlib/utils-escape-regexp-string';\nimport isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isRegExp from '@stdlib/assert-is-regexp';\nimport format from '@stdlib/string-format';\nimport base from '@stdlib/string-base-replace';\n\n\n// MAIN //\n\n/**\n* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument argument must be a string or regular expression\n* @throws {TypeError} third argument must be a string or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string-capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = new RegExp( rescape( search ), 'g' );\n\t} else if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string or regular expression. Value: `%s`.', search ) );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string or replacement function. Value: `%s`.', newval ) );\n\t}\n\treturn base( str, search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\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 replace from '@stdlib/string-replace';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// VARIABLES //\n\nvar CTORS = {\n\t'int8': 'new Int8Array( [ {{data}} ] )',\n\t'uint8': 'new Uint8Array( [ {{data}} ] )',\n\t'uint8c': 'new Uint8ClampedArray( [ {{data}} ] )',\n\t'int16': 'new Int16Array( [ {{data}} ] )',\n\t'uint16': 'new Uint16Array( [ {{data}} ] )',\n\t'int32': 'new Int32Array( [ {{data}} ] )',\n\t'uint32': 'new Uint32Array( [ {{data}} ] )',\n\t'float32': 'new Float32Array( [ {{data}} ] )',\n\t'float64': 'new Float64Array( [ {{data}} ] )',\n\t'generic': '[ {{data}} ]',\n\t'binary': 'new Buffer( [ {{data}} ] )',\n\t'complex64': 'new Complex64Array( [ {{data}} ] )',\n\t'complex128': 'new Complex128Array( [ {{data}} ] )'\n};\n\n\n// MAIN //\n\n/**\n* Serializes an ndarray as a string.\n*\n* ## Notes\n*\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @private\n* @returns {string} string representation\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar buffer;\n\tvar ndims;\n\tvar ctor;\n\tvar str;\n\tvar dt;\n\tvar v;\n\tvar i;\n\n\tndims = this._shape.length;\n\tdt = this._dtype;\n\n\t// Function to invoke to create an ndarray:\n\tstr = 'ndarray( \\''+dt+'\\', ';\n\n\t// Data buffer parameter...\n\tbuffer = '';\n\tif ( this._length <= 100 ) {\n\t\tif ( dt === 'complex64' || dt === 'complex128' ) {\n\t\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\t\tv = this.iget( i );\n\t\t\t\tbuffer += real( v ) + ', ' + imag( v );\n\t\t\t\tif ( i < this._length-1 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\t\tbuffer += this.iget( i );\n\t\t\t\tif ( i < this._length-1 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// First three values...\n\t\tif ( dt === 'complex64' || dt === 'complex128' ) {\n\t\t\tfor ( i = 0; i < 3; i++ ) {\n\t\t\t\tv = this.iget( i );\n\t\t\t\tbuffer += real( v ) + ', ' + imag( v );\n\t\t\t\tif ( i < 2 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 0; i < 3; i++ ) {\n\t\t\t\tbuffer += this.iget( i );\n\t\t\t\tif ( i < 2 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbuffer += ', ..., ';\n\n\t\t// Last three values...\n\t\tif ( dt === 'complex64' || dt === 'complex128' ) {\n\t\t\tfor ( i = 2; i >= 0; i-- ) {\n\t\t\t\tv = this.iget( this._length-1-i );\n\t\t\t\tbuffer += real( v ) + ', ' + imag( v );\n\t\t\t\tif ( i > 0 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 2; i >= 0; i-- ) {\n\t\t\t\tbuffer += this.iget( this._length-1-i );\n\t\t\t\tif ( i > 0 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tctor = CTORS[ this.dtype ];\n\tstr += replace( ctor, '{{data}}', buffer );\n\tstr += ', ';\n\n\t// Array shape...\n\tif ( ndims === 0 ) {\n\t\tstr += '[]';\n\t} else {\n\t\tstr += '[ ' + this._shape.join( ', ' ) + ' ]';\n\t}\n\tstr += ', ';\n\n\t// Stride array...\n\tstr += '[ ';\n\tif ( ndims === 0 ) {\n\t\tstr += '0';\n\t} else {\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\tif ( this._strides[ i ] < 0 ) {\n\t\t\t\tstr += -this._strides[ i ];\n\t\t\t} else {\n\t\t\t\tstr += this._strides[ i ];\n\t\t\t}\n\t\t\tif ( i < ndims-1 ) {\n\t\t\t\tstr += ', ';\n\t\t\t}\n\t\t}\n\t}\n\tstr += ' ]';\n\tstr += ', ';\n\n\t// Buffer offset:\n\tstr += '0';\n\tstr += ', ';\n\n\t// Order:\n\tstr += '\\'' + this._order + '\\'';\n\n\t// Close the function call:\n\tstr += ' )';\n\treturn str;\n\n\t/* eslint-enable no-invalid-this */\n}\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 ctors from './ctors.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if an environment is little endian.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment is little endian\n*\n* @example\n* var bool = isLittleEndian();\n* // returns \n*/\nfunction isLittleEndian() {\n\tvar uint16view;\n\tvar uint8view;\n\n\tuint16view = new ctors[ 'uint16' ]( 1 );\n\n\t/*\n\t* Set the uint16 view to a value having distinguishable lower and higher order words.\n\t*\n\t* 4660 => 0x1234 => 0x12 0x34 => '00010010 00110100' => (0x12,0x34) == (18,52)\n\t*/\n\tuint16view[ 0 ] = 0x1234;\n\n\t// Create a uint8 view on top of the uint16 buffer:\n\tuint8view = new ctors[ 'uint8' ]( uint16view.buffer );\n\n\t// If little endian, the least significant byte will be first...\n\treturn ( uint8view[ 0 ] === 0x34 );\n}\n\n\n// MAIN //\n\nbool = isLittleEndian();\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// MODULES //\n\nimport Uint8Array from '@stdlib/array-uint8';\nimport Uint16Array from '@stdlib/array-uint16';\n\n\n// MAIN //\n\nvar ctors = {\n\t'uint16': Uint16Array,\n\t'uint8': Uint8Array\n};\n\n\n// EXPORTS //\n\nexport default ctors;\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* Constructor which returns an object used to represent a generic, fixed-length raw binary data buffer.\n*\n* @module @stdlib/array-buffer\n*\n* @example\n* import ctor from '@stdlib/array-buffer';\n*\n* var buf = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasArrayBufferSupport from '@stdlib/assert-has-arraybuffer-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasArrayBufferSupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 main = ( typeof ArrayBuffer === 'function' ) ? ArrayBuffer : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof ArrayBuffer === 'function' ) ? ArrayBuffer : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport Float64Array from '@stdlib/array-float64';\nimport GlobalArrayBuffer from './arraybuffer.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `ArrayBuffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `ArrayBuffer` support\n*\n* @example\n* var bool = hasArrayBufferSupport();\n* // returns \n*/\nfunction hasArrayBufferSupport() {\n\tvar bool;\n\tvar view;\n\tvar buf;\n\n\tif ( typeof GlobalArrayBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tbuf = new GlobalArrayBuffer( 16 );\n\t\tbool = ( isArrayBuffer( buf ) && typeof GlobalArrayBuffer.isView === 'function' );\n\t\tif ( bool ) {\n\t\t\tview = new Float64Array( buf );\n\t\t\tview[ 0 ] = -3.14;\n\t\t\tview[ 1 ] = NaN;\n\t\t\tbool = (\n\t\t\t\tbool &&\n\t\t\t\tGlobalArrayBuffer.isView( view ) &&\n\t\t\t\tbuf.byteLength === 16 &&\n\t\t\t\tview[ 0 ] === -3.14 &&\n\t\t\t\tview[ 1 ] !== view[ 1 ]\n\t\t\t);\n\t\t}\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasArrayBufferSupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Constructor which returns an object used to represent a generic, fixed-length raw binary data buffer.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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* Constructor which returns a data view representing a provided array buffer.\n*\n* @module @stdlib/array-dataview\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* import DataView from '@stdlib/array-dataview';\n*\n* var buf = new ArrayBuffer( 10 );\n* // returns \n*\n* var dv = new DataView( buf );\n* // returns \n*/\n\n// MODULES //\n\nimport hasDataViewSupport from '@stdlib/assert-has-dataview-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasDataViewSupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasDataView = ( typeof DataView === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `DataView`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a DataView\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* import DataView from '@stdlib/array-dataview';\n*\n* var bool = isDataView( new DataView( new ArrayBuffer( 10 ) ) );\n* // returns true\n*\n* @example\n* var bool = isDataView( [] );\n* // returns false\n*/\nfunction isDataView( value ) {\n\treturn (\n\t\t( hasDataView && value instanceof DataView ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object DataView]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isDataView;\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\nvar main = ( typeof DataView === 'function' ) ? DataView : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\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\nvar ctor = ( typeof DataView === 'function' ) ? DataView : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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 isDataView from '@stdlib/assert-is-dataview';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport GlobalDataView from './dataview.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `DataView` support.\n*\n* @returns {boolean} boolean indicating if an environment has `DataView` support\n*\n* @example\n* var bool = hasDataViewSupport();\n* // returns \n*/\nfunction hasDataViewSupport() {\n\tvar bool;\n\tvar view;\n\tvar buf;\n\n\tif ( typeof GlobalDataView !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tbuf = new ArrayBuffer( 24 );\n\t\tview = new GlobalDataView( buf, 8 );\n\t\tbool = ( isDataView( view ) && typeof view.getFloat64 === 'function' && typeof view.setFloat64 === 'function' );\n\t\tif ( bool ) {\n\t\t\tview.setFloat64( 0, -3.14 );\n\t\t\tview.setFloat64( 8, NaN );\n\t\t\tbool = (\n\t\t\t\tbool &&\n\t\t\t\tview.buffer === buf &&\n\t\t\t\tview.byteLength === 16 &&\n\t\t\t\tview.byteOffset === 8 &&\n\t\t\t\tview.getFloat64( 0 ) === -3.14 &&\n\t\t\t\tview.getFloat64( 8 ) !== view.getFloat64( 8 )\n\t\t\t);\n\t\t}\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasDataViewSupport;\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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Constructor which returns a data view representing a provided array buffer.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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/* global BigInt */\n\n'use strict';\n\n// MAIN //\n\nvar BigInteger = ( typeof BigInt === 'function' ) ? BigInt : void 0; // eslint-disable-line stdlib/require-globals, node/no-unsupported-features/es-builtins\n\n\n// EXPORTS //\n\nexport default BigInteger;\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 MODES from './modes.json';\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray index modes.\n*\n* @returns {StringArray} list of ndarray index modes\n*\n* @example\n* var list = modes();\n* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]\n*/\nfunction modes() {\n\treturn MODES.slice();\n}\n\n\n// EXPORTS //\n\nexport default modes;\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 an object mapping supported index modes 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., `throw == 1`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects.\n*\n* @returns {Object} object mapping supported index modes to integer values\n*\n* @example\n* var table = enumerated();\n* // returns \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `index_modes.h` enumeration!!!!\n\treturn {\n\t\t'throw': 1,\n\t\t'clamp': 2,\n\t\t'wrap': 3,\n\t\t'normalize': 4\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumerated;\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 list of ndarray index modes.\n*\n* @module @stdlib/ndarray-index-modes\n*\n* @example\n* import modes from '@stdlib/ndarray-index-modes';\n*\n* var list = modes();\n* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport modes from './main.js';\nimport enumeration from './enum.js';\n\n\n// MAIN //\n\nsetReadOnly( modes, 'enum', enumeration );\n\n\n// EXPORTS //\n\nexport default modes;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport DataView from '@stdlib/array-dataview';\nimport BigInt from '@stdlib/bigint-ctor';\nimport { enum as dtypes } from '@stdlib/ndarray-dtypes';\nimport { enum as orders } from '@stdlib/ndarray-orders';\nimport { enum as modes } from '@stdlib/ndarray-index-modes';\n\n\n// VARIABLES //\n\nvar DTYPES = dtypes();\nvar ORDERS = orders();\nvar MODES = modes();\n\n\n// FUNCTIONS //\n\n/**\n* Serializes ndarray meta data to a `DataView`.\n*\n* ## Notes\n*\n* - This function takes into account ndarray-like objects which may support index modes.\n*\n* - This function defaults to returning cached serialized meta data. To force serialization, set the private `__meta_dataview__` property to `null`.\n*\n* - Serialization is performed according to host byte order (endianness).\n*\n* - Meta data format:\n*\n* ```text\n* | endianness (1 byte) | (2 bytes) | (8 bytes) | (ndims*8 bytes) | (ndims*8 bytes) | (8 bytes) | (1 byte) | (1 byte) | (8 bytes) | (nsubmodes*1 bytes) | (4 bytes) |\n* ```\n*\n* which translates to the following `ArrayBuffer` layout:\n*\n* ```text\n* ArrayBuffer[\n* [int8],\n* [int16],\n* [int64],\n* [ndims*int64],\n* [ndims*int64],\n* [int64],\n* [int8],\n* [int8],\n* [int64],\n* [nsubmodes*int8],\n* [int32]\n* ]\n* ```\n*\n* where `strides` and `offset` are in units of bytes.\n*\n* - If the endianness is `1`, the byte order is little endian. If the endianness is `0`, the byte order is big endian.\n*\n* - Buffer length:\n*\n* ```text\n* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) + 4 = 33 + (ndims*16) + nsubmodes\n* ```\n*\n* For example, consider a three-dimensional ndarray with one subscript index mode (submode):\n*\n* ```text\n* 33 + (3*16) + 1 = 82 bytes\n* ```\n*\n* - Views:\n*\n* - endianness: `Int8Array( buf, 0, 1 )`\n* - dtype: `Int16Array( buf, 1, 1 )`\n* - ndims: `Int64Array( buf, 3, 1 )`\n* - shape: `Int64Array( buf, 11, ndims )`\n* - strides: `Int64Array( buf, 11+(ndims*8), ndims )`\n* - offset: `Int64Array( buf, 11+(ndims*16), 1 )`\n* - order: `Int8Array( buf, 19+(ndims*16), 1 )`\n* - mode: `Int8Array( buf, 20+(ndims*16), 1 )`\n* - nsubmodes: `Int64Array( buf, 21+(ndims*16), 1 )`\n* - submodes: `Int8Array( buf, 29+(ndims*16), nsubmodes )`\n* - flags: `Int32Array( buf, 29+(ndims*16)+nsubmodes, 1 )`\n*\n* @private\n* @returns {DataView} serialized meta data\n*/\nfunction meta2dataview() {\n\t/* eslint-disable no-invalid-this */\n\tvar nbytes;\n\tvar flgs;\n\tvar len;\n\tvar dt;\n\tvar sh;\n\tvar st;\n\tvar sm;\n\tvar v;\n\tvar m;\n\tvar o;\n\tvar s;\n\tvar N;\n\tvar M;\n\tvar i;\n\n\tm = this._mode || 'throw';\n\tsm = this._submode || [ m ];\n\tN = this._ndims;\n\tM = sm.length;\n\n\t// Compute the amount of memory we need to allocate for storing meta data:\n\tlen = 33 + (N*16) + M;\n\n\t// Check if we've already serialized ndarray meta data and can reuse an already allocated array buffer...\n\tv = this.__meta_dataview__;\n\tif ( v && v.byteLength === len ) { // Note: the byte length check is only a bare minimum sanity check, as cached contents may still be \"stale\" (e.g., shape and/or strides may have changed)\n\t\treturn v;\n\t}\n\t// Allocate raw memory and create a view for interfacing with the allocated memory:\n\tv = new DataView( new ArrayBuffer( len ) );\n\n\t// Retrieve ndarray meta data:\n\tsh = this._shape;\n\tst = this._strides;\n\tdt = this._dtype;\n\tnbytes = this._bytesPerElement;\n\n\t// Endianness: (byteoffset: 0; bytelength: 1)\n\to = 0;\n\tv.setInt8( o, ( IS_LITTLE_ENDIAN ) ? 1 : 0 );\n\n\t// Data type: (byteoffset: 1; bytelength: 2)\n\to += 1;\n\tv.setInt16( o, DTYPES[ dt ], IS_LITTLE_ENDIAN );\n\n\t// Number of dimensions: (byteoffset: 3; bytelength: 8)\n\to += 2;\n\tv.setBigInt64( o, BigInt( N ), IS_LITTLE_ENDIAN );\n\n\t// Shape and strides: (byteoffset: 11 and 11+(ndims*8), respectively; bytelength: ndims*8 for both shape and strides, and, thus, ndims*16 total)\n\ts = N * 8; // stride length between a dimension (shape[i]) and its associated stride\n\to += 8;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tv.setBigInt64( o, BigInt( sh[i] ), IS_LITTLE_ENDIAN );\n\t\tv.setBigInt64( o+s, BigInt( st[i]*nbytes ), IS_LITTLE_ENDIAN );\n\t\to += 8;\n\t}\n\t// Offset: (byteoffset: 11+(ndims*16); bytelength: 8)\n\to += s;\n\tv.setBigInt64( o, BigInt( this._offset*nbytes ), IS_LITTLE_ENDIAN );\n\n\t// Order: (byteoffset: 19+(ndims*16); bytelength: 1)\n\to += 8;\n\tv.setInt8( o, ORDERS[ this._order ] );\n\n\t// Mode: (byteoffset: 20+(ndims*16); bytelength: 1)\n\to += 1;\n\tv.setInt8( o, MODES[ m ] );\n\n\t// Number of submodes: (byteoffset: 21+(ndims*16); bytelength: 8)\n\to += 1;\n\tv.setBigInt64( o, BigInt( M ), IS_LITTLE_ENDIAN );\n\n\t// Submodes: (byteoffset: 29+(ndims*16); bytelength: nsubmodes*1)\n\to += 8;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tv.setInt8( o, MODES[ sm[i] ] );\n\t\to += 1;\n\t}\n\t// Flags: (byteoffset: 29+(ndims*16)+nsubmodes; bytelength: 4)\n\tflgs = 0|0;\n\tflgs |= ( this._flags.READONLY ) ? 4 : 0; // 00000000 00000000 00000000 00000100\n\tv.setInt32( o, flgs, IS_LITTLE_ENDIAN );\n\n\t// Cache the serialized meta data:\n\tthis.__meta_dataview__ = v;\n\n\treturn v;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// EXPORTS //\n\nexport default meta2dataview;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport Uint8Array from '@stdlib/array-uint8';\nimport DataView from '@stdlib/array-dataview';\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// VARIABLES //\n\n// 0xFFFFFFFF = 2**32 - 1 => 11111111 11111111 11111111 11111111\nvar LOW_MASK = 0xFFFFFFFF >>> 0;\n\n// 2**32\nvar TWO_32 = 4294967296;\n\n// Byte array workspace:\nvar BYTES = new Uint8Array( 8 );\nvar VIEW = new DataView( BYTES.buffer );\n\n\n// MAIN //\n\n/**\n* Converts an integer-valued double-precision floating-point number to a signed 64-bit integer byte array according to host byte order (endianness).\n*\n* ## Notes\n*\n* - This function assumes that the input value is less than the maximum safe double-precision floating-point integer plus one (i.e., `2**53`).\n*\n* @param {number} x - input value\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var out = new Uint8Array( 8 );\n* var bytes = float64ToInt64Bytes( 1.0, out, 1, 0 );\n* // returns \n*/\nfunction float64ToInt64Bytes( x, out, stride, offset ) {\n\tvar hi;\n\tvar lo;\n\tvar i;\n\n\tif ( x === 0 ) {\n\t\tfor ( i = 0; i < BYTES.length; i++ ) {\n\t\t\tout[ offset ] = 0;\n\t\t\toffset += stride;\n\t\t}\n\t\treturn out;\n\t}\n\t// Get the low 32-bit word:\n\tlo = (x&LOW_MASK)>>>0;\n\n\t// Get the high 32-bit word:\n\thi = floor( x/TWO_32 );\n\n\t// Insert the high and low words according to host byte order (endianness):\n\tif ( IS_LITTLE_ENDIAN ) {\n\t\tVIEW.setUint32( 0, lo, IS_LITTLE_ENDIAN );\n\t\tVIEW.setUint32( 4, hi, IS_LITTLE_ENDIAN );\n\t} else {\n\t\tVIEW.setUint32( 0, hi, IS_LITTLE_ENDIAN );\n\t\tVIEW.setUint32( 4, lo, IS_LITTLE_ENDIAN );\n\t}\n\tfor ( i = 0; i < BYTES.length; i++ ) {\n\t\tout[ offset ] = BYTES[ i ];\n\t\toffset += stride;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default float64ToInt64Bytes;\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* Convert an integer-valued double-precision floating-point number to a signed 64-bit integer byte array according to host byte order (endianness).\n*\n* @module @stdlib/number-float64-base-to-int64-bytes\n*\n* @example\n* import float64ToInt64Bytes from '@stdlib/number-float64-base-to-int64-bytes';\n*\n* var bytes = float64ToInt64Bytes( 1.0 );\n* // returns \n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import float64ToInt64Bytes from '@stdlib/number-float64-base-to-int64-bytes';\n*\n* var out = new Uint8Array( 8 );\n* var bytes = float64ToInt64Bytes( 1.0, out, 1, 0 );\n* // returns \n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport Uint8Array from '@stdlib/array-uint8';\nimport DataView from '@stdlib/array-dataview';\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// VARIABLES //\n\n// 0xFFFFFFFF = 2**32 - 1 => 11111111 11111111 11111111 11111111\nvar LOW_MASK = 0xFFFFFFFF >>> 0;\n\n// 2**32\nvar TWO_32 = 4294967296;\n\n\n// MAIN //\n\n/**\n* Converts an integer-valued double-precision floating-point number to a signed 64-bit integer byte array according to host byte order (endianness).\n*\n* ## Notes\n*\n* - This function assumes that the input value is less than the maximum safe double-precision floating-point integer plus one (i.e., `2**53`).\n*\n* @param {number} x - input value\n* @returns {Uint8Array} byte array\n*\n* @example\n* var bytes = float64ToInt64Bytes( 1.0 );\n* // returns \n*/\nfunction float64ToInt64Bytes( x ) {\n\tvar bytes;\n\tvar view;\n\tvar hi;\n\tvar lo;\n\n\tbytes = new Uint8Array( 8 );\n\tif ( x === 0 ) {\n\t\treturn bytes;\n\t}\n\t// Get the low 32-bit word:\n\tlo = (x&LOW_MASK)>>>0;\n\n\t// Get the high 32-bit word:\n\thi = floor( x/TWO_32 );\n\n\t// Insert the high and low words according to host byte order (endianness):\n\tview = new DataView( bytes.buffer );\n\tif ( IS_LITTLE_ENDIAN ) {\n\t\tview.setUint32( 0, lo, IS_LITTLE_ENDIAN );\n\t\tview.setUint32( 4, hi, IS_LITTLE_ENDIAN );\n\t} else {\n\t\tview.setUint32( 0, hi, IS_LITTLE_ENDIAN );\n\t\tview.setUint32( 4, lo, IS_LITTLE_ENDIAN );\n\t}\n\treturn bytes;\n}\n\n\n// EXPORTS //\n\nexport default float64ToInt64Bytes;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport DataView from '@stdlib/array-dataview';\nimport Uint8Array from '@stdlib/array-uint8';\nimport { enum as dtypes } from '@stdlib/ndarray-dtypes';\nimport { enum as orders } from '@stdlib/ndarray-orders';\nimport { enum as modes } from '@stdlib/ndarray-index-modes';\nimport { assign as float64ToInt64Bytes } from '@stdlib/number-float64-base-to-int64-bytes';\n\n\n// VARIABLES //\n\nvar DTYPES = dtypes();\nvar ORDERS = orders();\nvar MODES = modes();\n\n\n// FUNCTIONS //\n\n/**\n* Serializes ndarray meta data to a `DataView`.\n*\n* ## Notes\n*\n* - This function takes into account ndarray-like objects which may support index modes.\n*\n* - This function defaults to returning cached serialized meta data. To force serialization, set the private `__meta_dataview__` property to `null`.\n*\n* - Serialization is performed according to host byte order (endianness).\n*\n* - Meta data format:\n*\n* ```text\n* | endianness (1 byte) | (2 bytes) | (8 bytes) | (ndims*8 bytes) | (ndims*8 bytes) | (8 bytes) | (1 byte) | (1 byte) | (8 bytes) | (nsubmodes*1 bytes) | (4 bytes) |\n* ```\n*\n* which translates to the following `ArrayBuffer` layout:\n*\n* ```text\n* ArrayBuffer[\n* [int8],\n* [int16],\n* [int64],\n* [ndims*int64],\n* [ndims*int64],\n* [int64],\n* [int8],\n* [int8],\n* [int64],\n* [nsubmodes*int8],\n* [int32]\n* ]\n* ```\n*\n* where `strides` and `offset` are in units of bytes.\n*\n* - If the endianness is `1`, the byte order is little endian. If the endianness is `0`, the byte order is big endian.\n*\n* - Buffer length:\n*\n* ```text\n* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) + 4 = 33 + (ndims*16) + nsubmodes\n* ```\n*\n* For example, consider a three-dimensional ndarray with one subscript index mode (submode):\n*\n* ```text\n* 33 + (3*16) + 1 = 82 bytes\n* ```\n*\n* - Views:\n*\n* - endianness: `Int8Array( buf, 0, 1 )`\n* - dtype: `Int16Array( buf, 1, 1 )`\n* - ndims: `Int64Array( buf, 3, 1 )`\n* - shape: `Int64Array( buf, 11, ndims )`\n* - strides: `Int64Array( buf, 11+(ndims*8), ndims )`\n* - offset: `Int64Array( buf, 11+(ndims*16), 1 )`\n* - order: `Int8Array( buf, 19+(ndims*16), 1 )`\n* - mode: `Int8Array( buf, 20+(ndims*16), 1 )`\n* - nsubmodes: `Int64Array( buf, 21+(ndims*16), 1 )`\n* - submodes: `Int8Array( buf, 29+(ndims*16), nsubmodes )`\n* - flags: `Int32Array( buf, 29+(ndims*16)+nsubmodes, 1 )`\n*\n* @private\n* @returns {DataView} serialized meta data\n*/\nfunction meta2dataview() {\n\t/* eslint-disable no-invalid-this */\n\tvar nbytes;\n\tvar bytes;\n\tvar flgs;\n\tvar len;\n\tvar dt;\n\tvar sh;\n\tvar st;\n\tvar sm;\n\tvar v;\n\tvar m;\n\tvar o;\n\tvar s;\n\tvar N;\n\tvar M;\n\tvar i;\n\n\tm = this._mode || 'throw';\n\tsm = this._submode || [ m ];\n\tN = this._ndims;\n\tM = sm.length;\n\n\t// Compute the amount of memory we need to allocate for storing meta data:\n\tlen = 33 + (N*16) + M;\n\n\t// Check if we've already serialized ndarray meta data and can reuse an already allocated array buffer...\n\tv = this.__meta_dataview__;\n\tif ( v && v.byteLength === len ) { // Note: the byte length check is only a bare minimum sanity check, as cached contents may still be \"stale\" (e.g., shape and/or strides may have changed)\n\t\treturn v;\n\t}\n\t// Allocate raw memory and create views for interfacing with the allocated memory:\n\tv = new DataView( new ArrayBuffer( len ) );\n\tbytes = new Uint8Array( v.buffer );\n\n\t// Retrieve ndarray meta data:\n\tsh = this._shape;\n\tst = this._strides;\n\tdt = this._dtype;\n\tnbytes = this._bytesPerElement;\n\n\t// Endianness: (byteoffset: 0; bytelength: 1)\n\to = 0;\n\tv.setInt8( o, ( IS_LITTLE_ENDIAN ) ? 1 : 0 );\n\n\t// Data type: (byteoffset: 1; bytelength: 2)\n\to += 1;\n\tv.setInt16( o, DTYPES[ dt ], IS_LITTLE_ENDIAN );\n\n\t// Number of dimensions: (byteoffset: 3; bytelength: 8)\n\to += 2;\n\tfloat64ToInt64Bytes( N, bytes, 1, o );\n\n\t// Shape and strides: (byteoffset: 11 and 11+(ndims*8), respectively; bytelength: ndims*8 for both shape and strides, and, thus, ndims*16 total)\n\ts = N * 8; // stride length between a dimension (shape[i]) and its associated stride\n\to += 8;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tfloat64ToInt64Bytes( sh[i], bytes, 1, o );\n\t\tfloat64ToInt64Bytes( st[i]*nbytes, bytes, 1, o+s );\n\t\to += 8;\n\t}\n\t// Offset: (byteoffset: 11+(ndims*16); bytelength: 8)\n\to += s;\n\tfloat64ToInt64Bytes( this._offset*nbytes, bytes, 1, o );\n\n\t// Order: (byteoffset: 19+(ndims*16); bytelength: 1)\n\to += 8;\n\tv.setInt8( o, ORDERS[ this._order ] );\n\n\t// Mode: (byteoffset: 20+(ndims*16); bytelength: 1)\n\to += 1;\n\tv.setInt8( o, MODES[ m ] );\n\n\t// Number of submodes: (byteoffset: 21+(ndims*16); bytelength: 8)\n\to += 1;\n\tfloat64ToInt64Bytes( M, bytes, 1, o );\n\n\t// Submodes: (byteoffset: 29+(ndims*16); bytelength: nsubmodes*1)\n\to += 8;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tv.setInt8( o, MODES[ sm[i] ] );\n\t\to += 1;\n\t}\n\t// Flags: (byteoffset: 29+(ndims*16)+nsubmodes; bytelength: 4)\n\tflgs = 0|0;\n\tflgs |= ( this._flags.READONLY ) ? 4 : 0; // 00000000 00000000 00000000 00000100\n\tv.setInt32( o, flgs, IS_LITTLE_ENDIAN );\n\n\t// Cache the serialized meta data:\n\tthis.__meta_dataview__ = v;\n\n\treturn v;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// EXPORTS //\n\nexport default meta2dataview;\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-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport hasBigIntSupport from '@stdlib/assert-has-bigint-support';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport bytesPerElement from '@stdlib/ndarray-base-bytes-per-element';\nimport iterationOrder from '@stdlib/ndarray-base-iteration-order';\nimport strides2order from '@stdlib/ndarray-base-strides2order';\nimport Boolean from '@stdlib/boolean-ctor';\nimport isColumnMajorContiguous from './is_column_major_contiguous.js';\nimport isRowMajorContiguous from './is_row_major_contiguous.js';\nimport isContiguous from './is_contiguous.js';\nimport copyFlags from './copy_flags.js';\nimport igetValue from './iget.js';\nimport isetValue from './iset.js';\nimport setValue from './set.js';\nimport getValue from './get.js';\nimport toJSON from './tojson.js';\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\nimport meta2dataview from './meta2dataview.js';\nimport meta2dataviewPolyfill from './meta2dataview.polyfill.js';\n\n\n// MAIN //\n\n/**\n* ndarray constructor.\n*\n* ## Notes\n*\n* - To create a zero-dimensional array,\n*\n* ```javascript\n* var buffer = [ 1 ];\n* var shape = [];\n* var strides = [ 0 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n* ```\n*\n* @constructor\n* @param {string} dtype - data type\n* @param {(ArrayLikeObject|TypedArray|Buffer)} buffer - data buffer\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - array strides\n* @param {NonNegativeInteger} offset - index offset\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*/\nfunction ndarray( dtype, buffer, shape, strides, offset, order ) {\n\tvar contiguous;\n\tvar nbytes;\n\tvar ord;\n\tvar len;\n\tvar i;\n\tif ( !(this instanceof ndarray) ) {\n\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order );\n\t}\n\t// Compute the number of elements...\n\tlen = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tlen *= shape[ i ];\n\t}\n\t// Compute the number of bytes...\n\tif ( buffer.BYTES_PER_ELEMENT ) {\n\t\tnbytes = buffer.BYTES_PER_ELEMENT * len;\n\t} else {\n\t\tnbytes = null;\n\t}\n\t// Set private properties...\n\tthis._byteLength = nbytes;\n\tthis._bytesPerElement = bytesPerElement( dtype );\n\tthis._buffer = buffer;\n\tthis._dtype = dtype;\n\tthis._length = len;\n\tthis._ndims = shape.length;\n\tthis._offset = offset;\n\tthis._order = order;\n\tthis._shape = shape;\n\tthis._strides = strides;\n\tthis._accessors = Boolean( buffer.get && buffer.set );\n\n\tthis._iterationOrder = iterationOrder( strides );\n\n\t// Determine if the array can be stored contiguously:\n\tcontiguous = isContiguous( len, shape, strides, offset, this._iterationOrder ); // eslint-disable-line max-len\n\n\t// Infer the array \"order\" from the stride array (this is supplementary to the `order` parameter):\n\tord = strides2order( strides );\n\n\tthis._flags = {\n\t\t'ROW_MAJOR_CONTIGUOUS': isRowMajorContiguous( ord, contiguous ),\n\t\t'COLUMN_MAJOR_CONTIGUOUS': isColumnMajorContiguous( ord, contiguous ),\n\t\t'READONLY': false\n\t};\n\n\t// Initialize a property for caching serialized meta data:\n\tthis.__meta_dataview__ = null;\n\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof ndarray\n* @type {string}\n* @default 'ndarray'\n*\n* @example\n* var str = ndarray.name;\n* // returns 'ndarray'\n*/\nsetReadOnly( ndarray, 'name', 'ndarray' );\n\n/**\n* Size (in bytes) of the array (if known).\n*\n* @name byteLength\n* @memberof ndarray.prototype\n* @type {(NonNegativeInteger|null)}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var buffer = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] );\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );\n*\n* var byteLength = x.byteLength;\n* // returns 48\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'byteLength', function get() {\n\treturn this._byteLength;\n});\n\n/**\n* Size (in bytes) of each array element (if known).\n*\n* @name BYTES_PER_ELEMENT\n* @memberof ndarray.prototype\n* @type {(PositiveInteger|null)}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var buffer = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] );\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );\n*\n* var nbytes = x.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'BYTES_PER_ELEMENT', function get() {\n\treturn this._bytesPerElement;\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name data\n* @memberof ndarray.prototype\n* @type {(Array|TypedArray|Buffer)}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var data = x.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'data', function get() {\n\treturn this._buffer;\n});\n\n/**\n* Underlying data type.\n*\n* @name dtype\n* @memberof ndarray.prototype\n* @type {string}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var dtype = x.dtype;\n* // returns 'generic'\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'dtype', function get() {\n\treturn this._dtype;\n});\n\n/**\n* Meta information, such as information concerning the memory layout of the array.\n*\n* @name flags\n* @memberof ndarray.prototype\n* @type {Object}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var flgs = x.flags;\n* // returns \n*/\nsetReadOnlyAccessor( ndarray.prototype, 'flags', function get() {\n\treturn copyFlags( this._flags );\n});\n\n/**\n* Length of the array.\n*\n* @name length\n* @memberof ndarray.prototype\n* @type {NonNegativeInteger}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var len = x.length;\n* // returns 6\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Number of dimensions.\n*\n* @name ndims\n* @memberof ndarray.prototype\n* @type {PositiveInteger}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var ndims = x.ndims;\n* // returns 2\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'ndims', function get() {\n\treturn this._ndims;\n});\n\n/**\n* Index offset which specifies the buffer index at which to start iterating over array elements.\n*\n* @name offset\n* @memberof ndarray.prototype\n* @type {NonNegativeInteger}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var o = x.offset;\n* // returns 0\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'offset', function get() {\n\treturn this._offset;\n});\n\n/**\n* Array order.\n*\n* ## Notes\n*\n* - The array order is either row-major (C-style) or column-major (Fortran-style).\n*\n* @name order\n* @memberof ndarray.prototype\n* @type {string}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var order = x.order;\n* // returns 'row-major'\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'order', function get() {\n\treturn this._order;\n});\n\n/**\n* Shape of the array.\n*\n* @name shape\n* @memberof ndarray.prototype\n* @type {NonNegativeIntegerArray}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var s = x.shape;\n* // returns [ 3, 2 ]\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'shape', function get() {\n\treturn this._shape.slice();\n});\n\n/**\n* Index strides which specify how to access data along corresponding array dimensions.\n*\n* @name strides\n* @memberof ndarray.prototype\n* @type {IntegerArray}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var s = x.strides;\n* // returns [ 2, 1 ]\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'strides', function get() {\n\treturn this._strides.slice();\n});\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name get\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'get', getValue );\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @name iget\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'iget', igetValue );\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name set\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*\n* x.set( 1, 1, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.get( 1, 1 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'set', setValue );\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @name iset\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*\n* x.iset( 3, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.iget( 3 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'iset', isetValue );\n\n/**\n* Serializes an ndarray as a string.\n*\n* ## Notes\n*\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @name toString\n* @memberof ndarray.prototype\n* @type {Function}\n* @returns {string} serialized ndarray\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var str = x.toString();\n* // returns \"ndarray( 'generic', [ 3, 4, 5, 6, 7, 8 ], [ 3, 2 ], [ 2, 1 ], 0, 'row-major' )\"\n*/\nsetReadOnly( ndarray.prototype, 'toString', toString );\n\n/**\n* Serializes an ndarray as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying an `ndarray` instance.\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @name toJSON\n* @memberof ndarray.prototype\n* @type {Function}\n* @returns {Object} serialized ndarray\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var o = x.toJSON();\n* // e.g., returns { 'type': 'ndarray', 'dtype': 'generic', 'flags': {...}, 'offset': 0, 'order': 'row-major', 'shape': [ 3, 2 ], 'strides': [ 2, 1 ], 'data': [ 3, 4, 5, 6, 7, 8 ] }\n*/\nsetReadOnly( ndarray.prototype, 'toJSON', toJSON );\n\n/**\n* Serializes ndarray meta data to a `DataView`.\n*\n* ## Notes\n*\n* - Meta data format:\n*\n* ```text\n* | (1 byte) | (2 bytes) | (8 bytes) | (ndims*8 bytes) | (ndims*8 bytes) | (8 bytes) | (1 byte) | (1 byte) | (8 bytes) | (nsubmodes*1 bytes) | (4 bytes) |\n* ```\n*\n* where `strides` and `offset` are in units of bytes.\n*\n* - If the endianness is `1`, the byte order is little endian. If the endianness is `0`, the byte order is big endian.\n*\n* - Serialization is performed according to host byte order (endianness).\n*\n* - Consumers of this method should treat the returned `DataView` as **immutable**. Otherwise, mutation can invalidate meta data and potentially affect other consumers.\n*\n* @private\n* @name __array_meta_dataview__\n* @memberof ndarray.prototype\n* @type {Function}\n* @returns {DataView} serialized meta data\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var dv = x.__array_meta_dataview__();\n* // returns \n*/\nsetReadOnly( ndarray.prototype, '__array_meta_dataview__', ( hasBigIntSupport() ) ? meta2dataview : meta2dataviewPolyfill );\n\n\n// EXPORTS //\n\nexport default ndarray;\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 BYTES_PER_ELEMENT from './bytes_per_element.json';\n\n\n// MAIN //\n\n/**\n* Returns the number of bytes per element provided an underlying array data type.\n*\n* @param {string} dtype - data type\n* @returns {(NonNegativeInteger|null)} number of bytes per element\n*\n* @example\n* var nbytes = bytesPerElement( 'float64' );\n* // returns 8\n*\n* nbytes = bytesPerElement( 'generic' );\n* // returns null\n*/\nfunction bytesPerElement( dtype ) {\n\treturn BYTES_PER_ELEMENT[ dtype ] || null;\n}\n\n\n// EXPORTS //\n\nexport default bytesPerElement;\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 array iteration order.\n*\n* ## Notes\n*\n* - Return value key:\n*\n* - `0`: unordered (i.e., strides of mixed sign; e.g., `[ 9, -3, 1 ]`)\n* - `1`: ordered left-to-right (i.e., all nonnegative strides)\n* - `-1`: ordered right-to-left (i.e., all negative strides)\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} iteration order\n*\n* @example\n* var o = iterationOrder( [ 2, 1 ] );\n* // returns 1\n*\n* o = iterationOrder( [ -2, 1 ] );\n* // returns 0\n*\n* o = iterationOrder( [ -2, -1 ] );\n* // returns -1\n*/\nfunction iterationOrder( strides ) {\n\tvar cnt;\n\tvar i;\n\n\tcnt = 0;\n\tfor ( i = 0; i < strides.length; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\tcnt += 1;\n\t\t}\n\t}\n\tif ( cnt === 0 ) {\n\t\t// All nonnegative strides:\n\t\treturn 1|0; // asm-type annotation\n\t}\n\tif ( cnt === strides.length ) {\n\t\t// All negative strides:\n\t\treturn -1|0; // asm-type annotation\n\t}\n\t// Strides of mixed signs:\n\treturn 0|0; // asm-type annotation\n}\n\n\n// EXPORTS //\n\nexport default iterationOrder;\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 minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n\n\n// MAIN //\n\n/**\n* Determines if an array is contiguous.\n*\n* @private\n* @param {NonNegativeInteger} len - array length\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @param {integer} iterationOrder - iteration order\n* @returns {boolean} boolean indicating if an array is contiguous\n*/\nfunction isContiguous( len, shape, strides, offset, iterationOrder ) {\n\tvar buf;\n\n\t// If an array does not contain any elements, then no data to store, and, if the array is unordered, adjacent array elements are not guaranteed to be stored next to each other.\n\tif ( len === 0 || iterationOrder === 0 ) {\n\t\treturn false;\n\t}\n\t// Ensure that the array is compatible with a single memory segment:\n\tbuf = minmaxViewBufferIndex( shape, strides, offset );\n\treturn ( len === ( buf[1]-buf[0]+1 ) );\n}\n\n\n// EXPORTS //\n\nexport default isContiguous;\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 abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\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 default ndarray settings.\n*\n* @returns {Object} defaults\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\treturn {\n\t\t// Data types:\n\t\t'dtypes': {\n\t\t\t'default': 'float64',\n\t\t\t'numeric': 'float64',\n\t\t\t'real': 'float64',\n\t\t\t'floating_point': 'float64',\n\t\t\t'real_floating_point': 'float64',\n\t\t\t'complex_floating_point': 'complex128',\n\t\t\t'integer': 'int32',\n\t\t\t'signed_integer': 'int32',\n\t\t\t'unsigned_integer': 'uint32',\n\t\t\t'boolean': 'bool'\n\t\t},\n\n\t\t// Memory layout:\n\t\t'order': 'row-major',\n\n\t\t// Casting mode:\n\t\t'casting': 'safe',\n\n\t\t// Index mode:\n\t\t'index_mode': 'throw'\n\t};\n}\n\n\n// EXPORTS //\n\nexport default defaults;\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* Copies ndarray flags.\n*\n* @private\n* @param {Object} flags - flags\n* @returns {Object} copy of input object\n*/\nfunction copyFlags( flags ) {\n\treturn {\n\t\t'ROW_MAJOR_CONTIGUOUS': flags.ROW_MAJOR_CONTIGUOUS,\n\t\t'COLUMN_MAJOR_CONTIGUOUS': flags.COLUMN_MAJOR_CONTIGUOUS,\n\t\t'READONLY': flags.READONLY\n\t};\n}\n\n\n// EXPORTS //\n\nexport default copyFlags;\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 an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} idx - indices\n* @returns {*} array element\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar idx;\n\tvar i;\n\n\tidx = this._offset;\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\tidx += this._strides[ i ] * arguments[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( idx );\n\t}\n\treturn this._buffer[ idx ];\n}\n\n\n// EXPORTS //\n\nexport default get;\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 an array element located a specified linear view index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @returns {*} array element\n*/\nfunction iget( idx ) {\n\t/* eslint-disable no-invalid-this */\n\tvar strides;\n\tvar shape;\n\tvar ndims;\n\tvar ind;\n\tvar s;\n\tvar i;\n\n\tndims = this._ndims;\n\tif ( ndims === 0 ) {\n\t\tif ( this._accessors ) {\n\t\t\treturn this._buffer.get( this._offset );\n\t\t}\n\t\treturn this._buffer[ this._offset ];\n\t}\n\tif ( this._flags.ROW_MAJOR_CONTIGUOUS || this._flags.COLUMN_MAJOR_CONTIGUOUS ) { // eslint-disable-line max-len\n\t\t// Trivial case where we have all positive strides...\n\t\tif ( this._iterationOrder === 1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\treturn this._buffer.get( this._offset+idx );\n\t\t\t}\n\t\t\treturn this._buffer[ this._offset+idx ];\n\t\t}\n\t\t// Trivial case where we have all negative strides...\n\t\tif ( this._iterationOrder === -1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\treturn this._buffer.get( this.offset-idx );\n\t\t\t}\n\t\t\treturn this._buffer[ this._offset-idx ];\n\t\t}\n\t}\n\t// The approach which follows is to resolve a view index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the underlying data buffer...\n\tshape = this._shape;\n\tstrides = this._strides;\n\tind = this._offset;\n\tif ( this._order === 'column-major' ) {\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\ts = idx % shape[ i ];\n\t\t\tidx -= s;\n\t\t\tidx /= shape[ i ];\n\t\t\tind += s * strides[ i ];\n\t\t}\n\t\tif ( this._accessors ) {\n\t\t\treturn this._buffer.get( ind );\n\t\t}\n\t\treturn this._buffer[ ind ];\n\t}\n\t// Case: row-major\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\ts = idx % shape[ i ];\n\t\tidx -= s;\n\t\tidx /= shape[ i ];\n\t\tind += s * strides[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( ind );\n\t}\n\treturn this._buffer[ ind ];\n}\n\n\n// EXPORTS //\n\nexport default iget;\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* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*/\nfunction set() {\n\t/* eslint-disable no-invalid-this */\n\tvar idx;\n\tvar i;\n\n\tidx = this._offset;\n\tfor ( i = 0; i < arguments.length-1; i++ ) {\n\t\tidx += this._strides[ i ] * arguments[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( arguments[ i ], idx );\n\t} else {\n\t\tthis._buffer[ idx ] = arguments[ i ];\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default set;\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* Sets an array element located a specified linear view index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*/\nfunction iset( idx, v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar strides;\n\tvar shape;\n\tvar ndims;\n\tvar ind;\n\tvar s;\n\tvar i;\n\n\tndims = this._ndims;\n\tif ( ndims === 0 ) {\n\t\tif ( this._accessors ) {\n\t\t\tthis._buffer.set( idx, this._offset );\n\t\t} else {\n\t\t\tthis._buffer[ this._offset ] = idx;\n\t\t}\n\t\treturn this;\n\t}\n\tif ( this._flags.ROW_MAJOR_CONTIGUOUS || this._flags.COLUMN_MAJOR_CONTIGUOUS ) { // eslint-disable-line max-len\n\t\t// Trivial case where we have all positive strides...\n\t\tif ( this._iterationOrder === 1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\tthis._buffer.set( v, this._offset+idx );\n\t\t\t} else {\n\t\t\t\tthis._buffer[ this._offset+idx ] = v;\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\t// Trivial case where we have all negative strides...\n\t\tif ( this._iterationOrder === -1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\tthis._buffer.set( v, this._offset-idx );\n\t\t\t} else {\n\t\t\t\tthis._buffer[ this._offset-idx ] = v;\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t}\n\t// The approach which follows is to resolve a view index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the underlying data buffer...\n\tshape = this._shape;\n\tstrides = this._strides;\n\tind = this._offset;\n\tif ( this._order === 'column-major' ) {\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\ts = idx % shape[ i ];\n\t\t\tidx -= s;\n\t\t\tidx /= shape[ i ];\n\t\t\tind += s * strides[ i ];\n\t\t}\n\t\tif ( this._accessors ) {\n\t\t\tthis._buffer.set( v, ind );\n\t\t} else {\n\t\t\tthis._buffer[ ind ] = v;\n\t\t}\n\t\treturn this;\n\t}\n\t// Case: row-major\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\ts = idx % shape[ i ];\n\t\tidx -= s;\n\t\tidx /= shape[ i ];\n\t\tind += s * strides[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( v, ind );\n\t} else {\n\t\tthis._buffer[ ind ] = v;\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default iset;\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 real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Serializes an ndarray as a JSON object.\n*\n* ## Notes\n*\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tlen = this._length;\n\n\t// Build an object containing all ndarray properties needed to revive a serialized ndarray...\n\tout = {};\n\tout.type = 'ndarray';\n\tout.dtype = this.dtype;\n\tout.flags = {\n\t\t'READONLY': this._flags.READONLY\n\t};\n\tout.order = this._order;\n\tout.shape = this._shape.slice();\n\tout.strides = this._strides.slice();\n\n\t// Flip the signs of negative strides:\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( out.strides[ i ] < 0 ) {\n\t\t\tout.strides[ i ] *= -1;\n\t\t}\n\t}\n\t// Cast data to generic array...\n\tout.data = [];\n\tif ( out.dtype === 'complex64' || out.dtype === 'complex128' ) {\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tv = this.iget( i );\n\t\t\tout.data.push( real( v ), imag( v ) );\n\t\t}\n\t} else {\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tout.data.push( this.iget( i ) );\n\t\t}\n\t}\n\treturn out;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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// MODULES //\n\nimport defaults from './main.js';\n\n\n// VARIABLES //\n\nvar DEFAULTS = defaults();\nvar HASH = {\n\t'dtypes.default': DEFAULTS.dtypes.default,\n\t'dtypes.numeric': DEFAULTS.dtypes.numeric,\n\t'dtypes.real': DEFAULTS.dtypes.real,\n\t'dtypes.floating_point': DEFAULTS.dtypes.floating_point,\n\t'dtypes.real_floating_point': DEFAULTS.dtypes.real_floating_point,\n\t'dtypes.complex_floating_point': DEFAULTS.dtypes.complex_floating_point,\n\t'dtypes.integer': DEFAULTS.dtypes.integer,\n\t'dtypes.signed_integer': DEFAULTS.dtypes.signed_integer,\n\t'dtypes.unsigned_integer': DEFAULTS.dtypes.unsigned_integer,\n\t'dtypes.boolean': DEFAULTS.dtypes.boolean,\n\t'order': DEFAULTS.order,\n\t'casting': DEFAULTS.casting,\n\t'index_mode': DEFAULTS.index_mode\n};\n\n\n// MAIN //\n\n/**\n* Returns a default ndarray setting.\n*\n* @param {string} name - setting name\n* @returns {*} default setting or null\n*\n* @example\n* var v = get( 'dtypes.default' );\n* // returns \n*/\nfunction get( name ) {\n\tvar v = HASH[ name ];\n\treturn ( v === void 0 ) ? null : v;\n}\n\n\n// EXPORTS //\n\nexport default get;\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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Tests that a value is a valid constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {(Error|null)} error object or null\n*\n* @example\n* var ctor = function ctor() {};\n*\n* var err = validate( ctor );\n* // returns null\n*\n* err = validate( null );\n* // returns \n*/\nfunction validate( value ) {\n\tvar type = typeof value;\n\tif (\n\t\tvalue === null ||\n\t\t(type !== 'object' && type !== 'function')\n\t) {\n\t\treturn new TypeError( format( 'invalid argument. A provided constructor must be either an object (except null) or a function. Value: `%s`.', value ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 default ndarray settings.\n*\n* @module @stdlib/ndarray-defaults\n*\n* @example\n* import defaults from '@stdlib/ndarray-defaults';\n*\n* var o = defaults();\n* // returns {...}\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport get from './get.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'get', get );\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// EXPORTS //\n\nexport default Object.create;\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\n/**\n* Dummy constructor.\n*\n* @private\n*/\nfunction Ctor() {\n\t// Empty...\n}\n\n\n// MAIN //\n\n/**\n* An `Object.create` shim for older JavaScript engines.\n*\n* @private\n* @param {Object} proto - prototype\n* @returns {Object} created object\n*\n* @example\n* var obj = createObject( Object.prototype );\n* // returns {}\n*/\nfunction createObject( proto ) {\n\tCtor.prototype = proto;\n\treturn new Ctor();\n}\n\n\n// EXPORTS //\n\nexport default createObject;\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 builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar createObject;\nif ( typeof builtin === 'function' ) {\n\tcreateObject = builtin;\n} else {\n\tcreateObject = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default createObject;\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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\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* Restricts an index to the interval `[0,max]`.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @returns {NonNegativeInteger} index\n*\n* @example\n* var idx = clampIndex( -1, 10 );\n* // returns 0\n*\n* idx = clampIndex( 15, 10 );\n* // returns 10\n*\n* idx = clampIndex( 5, 10 );\n* // returns 5\n*/\nfunction clampIndex( idx, max ) {\n\tif ( idx < 0 ) {\n\t\treturn 0;\n\t}\n\tif ( idx > max ) {\n\t\treturn max;\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default clampIndex;\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* Wraps an index on the interval `[0,max]`.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @returns {NonNegativeInteger} index\n*\n* @example\n* var idx = wrapIndex( -1, 10 );\n* // returns 10\n*\n* idx = wrapIndex( 13, 10 );\n* // returns 2\n*\n* idx = wrapIndex( 6, 10 );\n* // returns 6\n*/\nfunction wrapIndex( idx, max ) {\n\tvar mp1 = max + 1;\n\tif ( idx < 0 ) {\n\t\tidx += mp1; // slight optimization to avoid modulo arithmetic when |idx| <= max+1\n\t\tif ( idx < 0 ) {\n\t\t\tidx %= mp1;\n\t\t\tif ( idx !== 0 ) {\n\t\t\t\tidx += mp1;\n\t\t\t}\n\t\t}\n\t\treturn idx;\n\t}\n\tif ( idx > max ) {\n\t\tidx -= mp1; // slight optimization to avoid modulo arithmetic when max+1 < idx <= 2*(max+1)\n\t\tif ( idx > max ) {\n\t\t\tidx %= mp1;\n\t\t}\n\t\treturn idx;\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default wrapIndex;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Normalizes an index to the interval `[0,max]`.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @returns {integer} index\n*\n* @example\n* var idx = normalizeIndex( -2, 10 );\n* // returns 9\n*\n* idx = normalizeIndex( 15, 10 );\n* // returns -1\n*\n* idx = normalizeIndex( 5, 10 );\n* // returns 5\n*/\nfunction normalizeIndex( idx, max ) {\n\tif ( idx < 0 ) {\n\t\tidx += max + 1;\n\t\tif ( idx < 0 ) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn idx;\n\t}\n\tif ( idx > max ) {\n\t\treturn -1;\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default normalizeIndex;\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 { factory as contains } from '@stdlib/array-base-assert-contains';\nimport modes from '@stdlib/ndarray-index-modes';\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is a supported ndarray index mode.\n*\n* @name isIndexMode\n* @type {Function}\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode\n*\n* @example\n* var bool = isIndexMode( 'wrap' );\n* // returns true\n*\n* bool = isIndexMode( 'clamp' );\n* // returns true\n*\n* bool = isIndexMode( 'throw' );\n* // returns true\n*\n* bool = isIndexMode( 'foo' );\n* // returns false\n*/\nvar isIndexMode = contains( modes() );\n\n\n// EXPORTS //\n\nexport default isIndexMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 clampIndex from '@stdlib/ndarray-base-clamp-index';\nimport wrapIndex from '@stdlib/ndarray-base-wrap-index';\nimport normalize from '@stdlib/ndarray-base-normalize-index';\nimport isIndexMode from '@stdlib/ndarray-base-assert-is-index-mode';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar TABLE = {\n\t'wrap': wrapIndex,\n\t'clamp': clampIndex,\n\t'normalize': normalizeIndex,\n\t'throw': throwIfOutOfBounds\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an index if within bounds and throw an error otherwise.\n*\n* @private\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @throws {RangeError} index out-of-bounds\n* @returns {integer} index\n*\n* @example\n* var idx = throwIfOutOfBounds( 2, 9 );\n* // returns 2\n*\n* idx = throwIfOutOfBounds( 10, 9 );\n* // throws \n*\n* idx = throwIfOutOfBounds( -1, 9 );\n* // throws \n*/\nfunction throwIfOutOfBounds( idx, max ) {\n\tif ( idx < 0 || idx > max ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );\n\t}\n\treturn idx;\n}\n\n/**\n* Normalizes an index before performing a strict bounds check.\n*\n* @private\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @throws {RangeError} index out-of-bounds\n* @returns {integer} index\n*\n* @example\n* var idx = normalizeIndex( 1, 10 );\n* // returns 1\n*\n* idx = normalizeIndex( -4, 10 );\n* // returns 7\n*\n* idx = normalizeIndex( -100, 10 );\n* // throws \n*/\nfunction normalizeIndex( idx, max ) {\n\tvar index = normalize( idx, max );\n\tif ( index < 0 || index > max ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );\n\t}\n\treturn index;\n}\n\n\n// MAIN //\n\n/**\n* Returns a function for returning an index according to a provided index mode.\n*\n* @param {string} mode - specifies how to handle an out-of-bounds index\n* @throws {TypeError} first argument must be a recognized index mode\n* @returns {Function} function for returning an index\n*\n* @example\n* var ind = factory( 'clamp' );\n*\n* var idx = ind( 2, 9 );\n* // returns 2\n*\n* idx = ind( 10, 9 );\n* // returns 9\n*\n* idx = ind( -1, 9 );\n* // returns 0\n*\n* @example\n* var ind = factory( 'wrap' );\n*\n* var idx = ind( 2, 9 );\n* // returns 2\n*\n* idx = ind( 10, 9 );\n* // returns 0\n*\n* idx = ind( -1, 9 );\n* // returns 9\n*\n* @example\n* var ind = factory( 'throw' );\n*\n* var idx = ind( 2, 9 );\n* // returns 2\n*\n* idx = ind( 10, 9 );\n* // throws \n*\n* idx = ind( -1, 9 );\n* // throws \n*\n* @example\n* var ind = factory( 'normalize' );\n*\n* var idx = ind( 1, 10 );\n* // returns 1\n*\n* idx = ind( -4, 10 );\n* // returns 7\n*\n* idx = ind( -100, 10 );\n* // throws \n*/\nfunction factory( mode ) {\n\tif ( !isIndexMode( mode ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a recognized index mode. Value: `%s`.', mode ) );\n\t}\n\treturn TABLE[ mode ];\n}\n\n\n// EXPORTS //\n\nexport default factory;\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 clampIndex from '@stdlib/ndarray-base-clamp-index';\nimport wrapIndex from '@stdlib/ndarray-base-wrap-index';\nimport normalizeIndex from '@stdlib/ndarray-base-normalize-index';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns an index given an index mode.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @param {string} mode - specifies how to handle an index outside the interval `[0,max]`\n* @throws {RangeError} index out-of-bounds\n* @returns {integer} index\n*\n* @example\n* var idx = ind( 2, 9, 'clamp' );\n* // returns 2\n*\n* idx = ind( 10, 9, 'clamp' );\n* // returns 9\n*\n* idx = ind( -1, 9, 'clamp' );\n* // returns 0\n*\n* @example\n* var idx = ind( 2, 9, 'wrap' );\n* // returns 2\n*\n* idx = ind( 10, 9, 'wrap' );\n* // returns 0\n*\n* idx = ind( -1, 9, 'wrap' );\n* // returns 9\n*\n* @example\n* var idx = ind( 2, 9, 'throw' );\n* // returns 2\n*\n* idx = ind( 10, 9, 'throw' );\n* // throws \n*\n* idx = ind( -1, 9, 'throw' );\n* // throws \n*\n* @example\n* var idx = ind( 1, 10, 'normalize' );\n* // returns 1\n*\n* idx = ind( -4, 10, 'normalize' );\n* // returns 7\n*\n* idx = ind( -100, 10, 'normalize' );\n* // throws \n*/\nfunction ind( idx, max, mode ) {\n\tvar index;\n\tif ( mode === 'clamp' ) {\n\t\treturn clampIndex( idx, max );\n\t}\n\tif ( mode === 'wrap' ) {\n\t\treturn wrapIndex( idx, max );\n\t}\n\tindex = idx;\n\tif ( mode === 'normalize' ) {\n\t\tindex = normalizeIndex( index, max );\n\t}\n\tif ( index < 0 || index > max ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );\n\t}\n\treturn index;\n}\n\n\n// EXPORTS //\n\nexport default ind;\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 an index given an index mode.\n*\n* @module @stdlib/ndarray-base-ind\n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( -1, 10, 'wrap' );\n* // returns 10\n*\n* idx = ind( 14, 10, 'wrap' );\n* // returns 3\n*\n* idx = ind( 6, 10, 'wrap' );\n* // returns 6\n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( -1, 10, 'clamp' );\n* // returns 0\n*\n* idx = ind( 14, 10, 'clamp' );\n* // returns 10\n*\n* idx = ind( 6, 10, 'clamp' );\n* // returns 6\n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( 1, 10, 'throw' );\n* // returns 1\n*\n* idx = ind( 14, 10, 'throw' );\n* // throws \n*\n* idx = ind( -1, 10, 'throw' );\n* // throws \n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( 1, 10, 'normalize' );\n* // returns 1\n*\n* idx = ind( -4, 10, 'normalize' );\n* // returns 7\n*\n* idx = ind( -100, 10, 'normalize' );\n* // throws \n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var fcn = ind.factory( 'clamp' );\n*\n* var idx = fcn( -1, 10 );\n* // returns 0\n*\n* idx = fcn( 14, 10 );\n* // returns 10\n*\n* idx = fcn( 6, 10 );\n* // returns 6\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport factory from './factory.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport parent from '@stdlib/ndarray-base-ctor'; // eslint-disable-line stdlib/no-redeclare\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar base = parent.prototype.iget;\n\n\n// MAIN //\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @throws {TypeError} index must be an integer\n* @throws {RangeError} index exceeds array dimensions\n* @returns {*} array element\n*/\nfunction iget( idx ) {\n\tif ( this._ndims > 0 ) {\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( '0jp5O', idx ) );\n\t\t}\n\t\tidx = getIndex( idx, this._length-1, this._mode );\n\t\treturn base.call( this, idx );\n\t}\n\treturn base.call( this );\n}\n\n\n// EXPORTS //\n\nexport default iget;\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-invalid-this */\n\n'use strict';\n\n// METHODS //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport parent from '@stdlib/ndarray-base-ctor'; // eslint-disable-line stdlib/no-redeclare\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar base = parent.prototype.iset;\n\n\n// MAIN //\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @param {*} v - value to set\n* @throws {Error} cannot write to a read-only array\n* @throws {TypeError} index must be an integer\n* @throws {RangeError} index exceeds array dimensions\n* @returns {ndarray} ndarray instance\n*/\nfunction iset( idx, v ) {\n\tif ( this._flags.READONLY ) {\n\t\tthrow new Error( format('0jp0e') );\n\t}\n\tif ( this._ndims > 0 ) {\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( '0jp5O', idx ) );\n\t\t}\n\t\tidx = getIndex( idx, this._length-1, this._mode );\n\t\tbase.call( this, idx, v );\n\t} else {\n\t\tbase.call( this, idx );\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default iset;\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* Copies the contents of array-like value to a new array.\n*\n* @private\n* @param {ArrayLike} arr - input array\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} output array\n*\n* @example\n* var arr = [ 1.0, 2.0, 3.0 ];\n*\n* var out = copy( arr, arr.length );\n* // returns [ 1.0, 2.0, 3.0 ]\n*\n* var bool = ( arr === out );\n* // returns false\n*/\nfunction copy( arr, len ) {\n\tvar out;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout.push( arr[ i ] );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default copy;\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 an object.\n*\n* @name Object\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {Object} object\n*\n* @example\n* var o = new Object( null );\n* // returns {}\n*\n* @example\n* var o = new Object( 5.0 );\n* // returns \n*\n* @example\n* var o = new Object( 'beep' );\n* // returns \n*\n* @example\n* var o1 = {};\n*\n* var o2 = new Object( o1 );\n* // returns {}\n*\n* var bool = ( o1 === o2 );\n* // returns true\n*/\nvar Obj = Object; // eslint-disable-line stdlib/require-globals\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// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nexport default getProto;\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 getProto from './proto.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 from '@stdlib/assert-is-object';\nimport isFunction from '@stdlib/assert-is-function';\nimport getPrototypeOf from '@stdlib/utils-get-prototype-of';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPlainObject;\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 Object from '@stdlib/object-ctor';\nimport getProto from './detect.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport isCollection from '@stdlib/assert-is-collection';\nimport { primitives as isNonNegativeIntegerArray } from '@stdlib/assert-is-nonnegative-integer-array';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport { primitives as isIntegerArray } from '@stdlib/assert-is-integer-array';\nimport isFunction from '@stdlib/assert-is-function';\nimport isOrder from '@stdlib/ndarray-base-assert-is-order';\nimport isDataType from '@stdlib/ndarray-base-assert-is-data-type';\nimport isBufferLengthCompatible from '@stdlib/ndarray-base-assert-is-buffer-length-compatible';\nimport numel from '@stdlib/ndarray-base-numel';\nimport parent from '@stdlib/ndarray-base-ctor'; // eslint-disable-line stdlib/no-redeclare\nimport defaults from '@stdlib/ndarray-defaults';\nimport inherit from '@stdlib/utils-inherit';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport iget from './iget.js';\nimport iset from './iset.js';\nimport get from './get.js';\nimport set from './set.js';\nimport copy from './copy_array.js';\nimport validate from './validate.js';\n\n\n// VARIABLES //\n\n/*\n* See the following references:\n*\n* - https://stackoverflow.com/questions/22747068/is-there-a-max-number-of-arguments-javascript-functions-can-accept\n* - https://bugs.webkit.org/show_bug.cgi?id=80797\n* - https://github.com/numpy/numpy/issues/5744\n*\n* Note that the maximum number of function arguments can vary from engine to engine. Here, we choose something of a lowest common denominator which may **not** be valid everywhere.\n*/\nvar MAX_DIMS = 32767|0;\n\nvar INDEX_MODE = defaults.get( 'index_mode' );\nvar READONLY = false;\n\n\n// MAIN //\n\n/**\n* ndarray constructor.\n*\n* @constructor\n* @param {string} dtype - data type\n* @param {Collection} buffer - data buffer\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - array strides\n* @param {NonNegativeInteger} offset - index offset\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {Options} [options] - function options\n* @param {string} [options.mode=\"throw\"] - specifies how to handle indices which exceed array dimensions\n* @param {StringArray} [options.submode=[\"throw\"]] - specifies how to handle subscripts which exceed array dimensions on a per dimension basis\n* @param {boolean} [options.readonly=false] - boolean indicating whether an array should be read-only\n* @throws {TypeError} `dtype` argument must be a supported ndarray data type\n* @throws {TypeError} `buffer` argument must be an array-like object, typed-array-like, or a Buffer\n* @throws {TypeError} `buffer` argument `get` and `set` properties must be functions\n* @throws {TypeError} `shape` argument must be an array-like object containing nonnegative integers\n* @throws {Error} `shape` argument length must equal the number of dimensions\n* @throws {TypeError} `strides` argument must be an array-like object containing integers\n* @throws {Error} `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`)\n* @throws {Error} for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0`\n* @throws {TypeError} `offset` argument must be a nonnegative integer\n* @throws {TypeError} `order` argument must be a supported ndarray order\n* @throws {Error} `buffer` argument must be compatible with specified meta data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} too many dimensions\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*/\nfunction ndarray( dtype, buffer, shape, strides, offset, order, options ) {\n\tvar ndims;\n\tvar opts;\n\tvar err;\n\tvar sh;\n\tvar st;\n\n\tif ( !(this instanceof ndarray) ) {\n\t\tif ( arguments.length < 7 ) {\n\t\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order );\n\t\t}\n\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order, options ); // eslint-disable-line max-len\n\t}\n\tif ( !isDataType( dtype ) ) {\n\t\tthrow new TypeError( format( '0jp5P', dtype ) );\n\t}\n\tif ( !isCollection( buffer ) ) {\n\t\tthrow new TypeError( format( '0jp5Q', buffer ) );\n\t} else if ( buffer.get && buffer.set && ( !isFunction( buffer.get ) || !isFunction( buffer.set ) ) ) { // eslint-disable-line max-len\n\t\tthrow new TypeError( format( '0jp5R', buffer ) );\n\t}\n\tif ( !isNonNegativeIntegerArray( shape ) ) {\n\t\tif ( !isCollection( shape) || shape.length > 0 ) {\n\t\t\tthrow new TypeError( format( '0jp5S', shape ) );\n\t\t}\n\t}\n\tndims = shape.length;\n\tif ( ndims > MAX_DIMS ) {\n\t\tthrow new RangeError( format( '0jp5T', MAX_DIMS, ndims ) );\n\t}\n\tif ( !isIntegerArray( strides ) ) {\n\t\tthrow new TypeError( format( '0jp5U', strides ) );\n\t}\n\tif ( ndims > 0 ) {\n\t\tif ( strides.length !== ndims ) {\n\t\t\tthrow new RangeError( format( '0jp5V', ndims, strides.length ) );\n\t\t}\n\t} else if ( strides.length !== 1 ) {\n\t\tthrow new RangeError( format('0jp0f') );\n\t} else if ( strides[ 0 ] !== 0 ) {\n\t\tthrow new RangeError( format( '0jpDt', strides[ 0 ] ) );\n\t}\n\tif ( !isNonNegativeInteger( offset ) ) {\n\t\tthrow new TypeError( format( '0jp5X', offset ) );\n\t}\n\tif ( !isOrder( order ) ) {\n\t\tthrow new TypeError( format( '0jp5Y', order ) );\n\t}\n\tif ( ndims > 0 && !isBufferLengthCompatible( buffer.length, shape, strides, offset ) && numel( shape ) > 0 ) { // eslint-disable-line max-len\n\t\tthrow new Error( format('0jpCz') );\n\t}\n\topts = {};\n\topts.mode = INDEX_MODE;\n\topts.readonly = READONLY;\n\tif ( arguments.length > 6 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tthis._mode = opts.mode;\n\tif ( opts.submode === void 0 ) {\n\t\topts.submode = [ this._mode ];\n\t}\n\tthis._submode = opts.submode;\n\n\t// Copy `shape` and `strides` to prevent external mutation:\n\tsh = copy( shape, ndims );\n\tst = copy( strides, ndims || 1 );\n\n\t// Call the parent constructor:\n\tparent.call( this, dtype, buffer, sh, st, offset, order );\n\tthis._flags.READONLY = opts.readonly;\n\n\treturn this;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n// Inherit from the parent constructor:\ninherit( ndarray, parent );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof ndarray\n* @type {string}\n* @default 'ndarray'\n*\n* @example\n* var str = ndarray.name;\n* // returns 'ndarray'\n*/\nsetReadOnly( ndarray, 'name', 'ndarray' );\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name get\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'get', get );\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @name iget\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'iget', iget );\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name set\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*\n* x.set( 1, 1, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.get( 1, 1 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'set', set );\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @name iset\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*\n* x.iset( 3, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.iget( 3 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'iset', iset );\n\n\n// EXPORTS //\n\nexport default ndarray;\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 minmax from '@stdlib/ndarray-base-minmax-view-buffer-index';\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a buffer length is compatible with provided ndarray meta data.\n*\n* @param {NonNegativeInteger} len - buffer length\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @returns {boolean} boolean indicating if a buffer length is compatible\n*\n* @example\n* var shape = [ 2, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var bool = isBufferLengthCompatible( 4, shape, strides, offset );\n* // returns true\n*\n* @example\n* var shape = [ 2, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var bool = isBufferLengthCompatible( 4, shape, strides, offset );\n* // returns false\n*/\nfunction isBufferLengthCompatible( len, shape, strides, offset ) {\n\t// Determine the minimum and maximum linear indices which are accessible by the array view:\n\tvar buf = minmax( shape, strides, offset );\n\n\t// If the indices are \"inbounds\", then the buffer length is compatible:\n\treturn ( buf[ 0 ] >= 0 && buf[ 1 ] < len );\n}\n\n\n// EXPORTS //\n\nexport default isBufferLengthCompatible;\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 number of elements in an array.\n*\n* @param {(NonNegativeIntegerArray|EmptyArray)} shape - array shape\n* @returns {NonNegativeInteger} number of elements\n*\n* @example\n* var n = numel( [ 3, 3, 3 ] );\n* // returns 27\n*/\nfunction numel( shape ) {\n\tvar ndims;\n\tvar n;\n\tvar i;\n\n\tndims = shape.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0;\n\t}\n\tn = 1;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tn *= shape[ i ];\n\t}\n\treturn n;\n}\n\n\n// EXPORTS //\n\nexport default numel;\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 from '@stdlib/assert-is-plain-object';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isIndexMode from '@stdlib/ndarray-base-assert-is-index-mode';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.mode] - specifies how to handle indices which exceed array dimensions\n* @param {StringArray} [options.submode] - specifies how to handle subscripts which exceed array dimensions\n* @param {boolean} [options.readonly] - boolean indicating whether an array should be read-only\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'mode': 'clamp',\n* 'submode': [ 'throw', 'wrap', 'clamp' ]\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( '0jp2V', options ) );\n\t}\n\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\topts.mode = options.mode;\n\t\tif ( !isIndexMode( opts.mode ) ) {\n\t\t\treturn new TypeError( format( '0jp5a', 'mode', opts.mode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'submode' ) ) {\n\t\topts.submode = options.submode;\n\t\tif ( !isArrayLikeObject( opts.submode ) ) {\n\t\t\treturn new TypeError( format( '0jp5b', 'submode', opts.submode ) );\n\t\t}\n\t\tif ( opts.submode.length === 0 ) {\n\t\t\treturn new TypeError( format( '0jp5b', 'submode', opts.submode.join( ',' ) ) );\n\t\t}\n\t\tfor ( i = 0; i < opts.submode.length; i++ ) {\n\t\t\tif ( !isIndexMode( opts.submode[ i ] ) ) {\n\t\t\t\treturn new TypeError( format( '0jp5c', opts.submode[ i ] ) );\n\t\t\t}\n\t\t}\n\t\topts.submode = opts.submode.slice();\n\t}\n\tif ( hasOwnProp( options, 'readonly' ) ) {\n\t\topts.readonly = options.readonly;\n\t\tif ( !isBoolean( opts.readonly ) ) {\n\t\t\treturn new TypeError( format( '0jp2o', 'readonly', opts.readonly ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport createObject from './detect.js';\n\n\n// MAIN //\n\n/**\n* Implements prototypical inheritance by replacing the prototype of one constructor with the prototype of another constructor.\n*\n* ## Notes\n*\n* - This implementation is not designed to work with ES2015/ES6 classes. For ES2015/ES6 classes, use `class` with `extends`.\n* - For reference, see [node#3455](https://github.com/nodejs/node/pull/3455), [node#4179](https://github.com/nodejs/node/issues/4179), [node#3452](https://github.com/nodejs/node/issues/3452), and [node commit](https://github.com/nodejs/node/commit/29da8cf8d7ab8f66b9091ab22664067d4468461e#diff-3deb3f32958bb937ae05c6f3e4abbdf5).\n*\n* @param {(Object|Function)} ctor - constructor which will inherit\n* @param {(Object|Function)} superCtor - super (parent) constructor\n* @throws {TypeError} first argument must be either an object or a function which can inherit\n* @throws {TypeError} second argument must be either an object or a function from which a constructor can inherit\n* @throws {TypeError} second argument must have an inheritable prototype\n* @returns {(Object|Function)} child constructor\n*\n* @example\n* function Foo() {\n* return this;\n* }\n* Foo.prototype.beep = function beep() {\n* return 'boop';\n* };\n*\n* function Bar() {\n* Foo.call( this );\n* return this;\n* }\n* inherit( Bar, Foo );\n*\n* var bar = new Bar();\n* var v = bar.beep();\n* // returns 'boop'\n*/\nfunction inherit( ctor, superCtor ) {\n\tvar err = validate( ctor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\terr = validate( superCtor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( typeof superCtor.prototype === 'undefined' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must have a prototype from which another object can inherit. Value: `%s`.', superCtor.prototype ) );\n\t}\n\t// Create a prototype which inherits from the parent prototype:\n\tctor.prototype = createObject( superCtor.prototype );\n\n\t// Set the constructor to refer to the child constructor:\n\tdefineProperty( ctor.prototype, 'constructor', {\n\t\t'configurable': true,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': ctor\n\t});\n\n\treturn ctor;\n}\n\n\n// EXPORTS //\n\nexport default inherit;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @throws {TypeError} provided indices must be integer valued\n* @throws {RangeError} index exceeds array dimensions\n* @throws {RangeError} number of indices must equal the number of dimensions\n* @returns {*} array element\n*/\nfunction get() {\n\tvar idx;\n\tvar ind;\n\tvar M;\n\tvar i;\n\n\tif ( arguments.length !== this._ndims ) {\n\t\tthrow new RangeError( format( '0jp5M', this._ndims, arguments.length ) );\n\t}\n\tidx = this._offset;\n\tM = this._submode.length;\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\tif ( !isInteger( arguments[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0jp5N', i, arguments[ i ] ) );\n\t\t}\n\t\tind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len\n\t\tidx += this._strides[ i ] * ind;\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( idx );\n\t}\n\treturn this._buffer[ idx ];\n}\n\n\n// EXPORTS //\n\nexport default get;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @throws {Error} cannot write to a read-only array\n* @throws {TypeError} provided indices must be integer valued\n* @throws {RangeError} index exceeds array dimensions\n* @throws {RangeError} number of indices must equal the number of dimensions\n* @returns {ndarray} ndarray instance\n*/\nfunction set() {\n\tvar idx;\n\tvar ind;\n\tvar M;\n\tvar i;\n\n\tif ( this._flags.READONLY ) {\n\t\tthrow new Error( format('0jp0e') );\n\t}\n\tif ( arguments.length !== this._ndims+1 ) {\n\t\tthrow new RangeError( format( '0jp5M', this._ndims, arguments.length ) );\n\t}\n\tidx = this._offset;\n\tM = this._submode.length;\n\tfor ( i = 0; i < arguments.length-1; i++ ) {\n\t\tif ( !isInteger( arguments[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0jpDu', i, arguments[ i ] ) );\n\t\t}\n\t\tind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len\n\t\tidx += this._strides[ i ] * ind;\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( arguments[ i ], idx );\n\t} else {\n\t\tthis._buffer[ idx ] = arguments[ i ];\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default set;\n"],"names":["main","Object","defineProperty","isNumber","value","zeros","n","i","out","zeroPad","str","width","right","negative","pad","length","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","push","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","defineProperty$1","setNonEnumerableReadOnly","configurable","enumerable","writable","floor","isInteger","x","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","nativeClass","hasToStringTag","v","isOwn","tag","main$e","Number","test","isPrimitive","isObject","setReadOnly","FLOAT64_PINF","POSITIVE_INFINITY","FLOAT64_NINF","NEGATIVE_INFINITY","PINF","NINF","isInt","valueOf","isNonNegativeInteger","MAX_ARRAY_LENGTH","arraylikefcn","predicate","len","isArrayLike","isPrimitiveArray","arrayfun","isObjectArray","isNonNegativeIntegerArray","isIntegerArray","isBoolean","Bool","Boolean","self","window","globalThis","getGlobal","codegen","Function","GlobalThis","Self","Win","root","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$d","isObjectLike","isObjectLikeArray","isBuffer","_isBuffer","constructor","constructorName","name","ctor","ctorName","type","isFunction","typeOf","orders","ORDERS","enumerated","DATA","enumeration","LAYOUTS","TYPE","isAccessorArray","GETTERS","complex128","arr","idx","complex64","default","getter","dtype","float64","float32","int32","int16","int8","uint32","uint16","uint8","uint8c","generic","ctor2dtypes","Float32Array","Float64Array","Int16Array","Int32Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","Complex64Array","Complex128Array","hasFloat64Array","bool","GlobalFloat64Array","NaN","hasFloat64ArraySupport","Float64Array$1","hasFloat32Array","GlobalFloat32Array","hasFloat32ArraySupport","Float32Array$1","hasUint32Array","UINT32_MAX","GlobalUint32Array","hasUint32ArraySupport","Uint32Array$1","hasInt32Array","GlobalInt32Array","INT32_MAX","hasInt32ArraySupport","Int32Array$1","hasUint16Array","GlobalUint16Array","UINT16_MAX","hasUint16ArraySupport","Uint16Array$1","hasInt16Array","GlobalInt16Array","INT16_MAX","hasInt16ArraySupport","Int16Array$1","hasUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","Uint8Array$1","hasUint8ClampedArray","GlobalUint8ClampedArray","hasUint8ClampedArraySupport","Uint8ClampedArray$1","hasInt8Array","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","Int8Array$1","isArrayLikeObject","hasArrayBuffer","ArrayBuffer","isArrayBuffer","isString","Complex128","real","imag","this","re","im","fround","FLOAT32_VIEW","float64ToFloat32$1","Complex64","float64ToFloat32","isComplexLike","isEven","BYTES_PER_ELEMENT","isComplex64Array","isComplex128Array","hasIteratorSymbolSupport","iterator","IteratorSymbol","setNonEnumerableReadOnlyAccessor","realf","z","imagf","reinterpret","offset","buffer","byteOffset","fromIterator","it","next","done","HAS_ITERATOR_SYMBOL","isComplexArray","_length","_buffer","isComplexArrayConstructor","getComplex64","buf","nargs","fromArray","RangeError","reinterpret64","reinterpret128","byteLength","ITERATOR_SYMBOL","src","thisArg","clbk","tmp","flg","accessorGetter","fromIteratorMap","target","start","copyWithin","iter","entries","end","fcn","searchElement","fromIndex","separator","sep","join","outbuf","reducer","initialValue","acc","N","sbuf","outlen","begin","index","getComplex128","CTORS","DTYPES","NTYPES","ctor2dtype","factory","dt","search","newval","RE_SUFFIX","dtypes","kind","all","int64","uint64","binary","notype","userdefined_type","keys","isArguments","bool$7","detect","hasArgumentsClass","isNan","isEnumerableProperty","propertyIsEnumerable","hasStringEnumBug","isEnum","isArguments$1","isConstructorPrototype","w","hasAutomationEqualityBug","k","win","EXCLUDED_KEYS","check","HAS_BUILTIN","skipConstructor","skipPrototype","isFcn","p","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","HAS_WINDOW","error","NON_ENUMERABLE","main$2","source","objectKeys","assign","isDataType","contains","minmaxViewBufferIndex","shape","strides","ndims","min","max","s","Global","isColumnMajorContiguous","order","contiguous","isRowMajorContiguous","RE_CHARS","RegExp","isRegExp","rescape","uint16view","ctors","IS_LITTLE_ENDIAN","view","GlobalArrayBuffer","isView","hasArrayBufferSupport","ArrayBuffer$1","hasDataView","DataView","GlobalDataView","getFloat64","setFloat64","hasDataViewSupport","DataView$1","BigInteger","BigInt","modes","MODES","throw","clamp","wrap","normalize","LOW_MASK","TWO_32","BYTES","VIEW","float64ToInt64Bytes","stride","hi","lo","setUint32","bytes","ndarray","nbytes","ord","_byteLength","_bytesPerElement","bytesPerElement","_dtype","_ndims","_offset","_order","_shape","_strides","_accessors","_iterationOrder","cnt","iterationOrder","isContiguous","column","row","s1","s2","strides2order","_flags","ROW_MAJOR_CONTIGUOUS","COLUMN_MAJOR_CONTIGUOUS","READONLY","__meta_dataview__","defaults","numeric","floating_point","real_floating_point","complex_floating_point","integer","signed_integer","unsigned_integer","boolean","casting","index_mode","ind","iget","data","flgs","sh","st","sm","m","o","M","_mode","_submode","setInt8","setInt16","setBigInt64","setInt32","DEFAULTS","HASH","validate","create","Ctor","createObject$1","proto","fmtprodmsg","a","u","encodeURIComponent","clampIndex","wrapIndex","mp1","normalizeIndex","isIndexMode","TABLE","mode","parent","iset","copy","getProto","Obj","getPrototypeOf","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","key","ownProps","INDEX_MODE","options","opts","isOrder","minmax","isBufferLengthCompatible","numel","readonly","submode","superCtor","createObject","inherit","getIndex"],"mappings":";yCAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCjFA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,IACIC,EADAC,EAAM,GAEV,IAAMD,EAAI,EAAGA,EAAID,EAAGC,IACnBC,GAAO,IAER,OAAOA,CACR,CAcA,SAASC,EAASC,EAAKC,EAAOC,GAC7B,IAAIC,GAAW,EACXC,EAAMH,EAAQD,EAAIK,OACtB,OAAKD,EAAM,IAnCZ,SAA0BJ,GACzB,MAAoB,MAAbA,EAAK,EACb,CAoCMM,CAAiBN,KACrBG,GAAW,EACXH,EAAMA,EAAIO,OAAQ,IAEnBP,EAAM,EACLA,EAAML,EAAOS,GACbT,EAAOS,GAAQJ,EACXG,IACJH,EAAM,IAAMA,IAVLA,CAaT,CCpDA,IAAIQ,EAAYC,OAAOC,UAAUC,YAC7BC,EAAYH,OAAOC,UAAUG,YAajC,SAASC,EAAeC,GACv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tB,IAAM1V,GAAW0F,GAChB,MAAM,IAAI3I,UAAWgB,GAAQ,QAAS2H,IAEvCA,EAAMyV,GAAUzV,EAAK8E,KAAK8B,QAAQ,EAAG9B,KAAK2N,OAC1Cje,GAAKW,KAAM2P,KAAM9E,EAAKzE,EACxB,MACE/G,GAAKW,KAAM2P,KAAM9E,GAElB,OAAO8E,IACR","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,301,302,303,304,305,306,307,309,310,312]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 0b44231..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import ctor from '../docs/types/index'; -export = ctor; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index fff993e..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var o=function(e,i){return function(){return i||e((i={exports:{}}).exports,i),i.exports}};var p=o(function(Ve,y){"use strict";var Y=require("@stdlib/assert-is-integer").isPrimitive,B=require("@stdlib/ndarray-base-ind"),X=require("@stdlib/ndarray-base-ctor"),G=require("@stdlib/string-format"),w=X.prototype.iget;function H(e){if(this._ndims>0){if(!Y(e))throw new TypeError(G("invalid argument. Index must be an integer. Value: `%s`.",e));return e=B(e,this._length-1,this._mode),w.call(this,e)}return w.call(this)}y.exports=H});var _=o(function(xe,E){"use strict";var J=require("@stdlib/assert-is-integer").isPrimitive,K=require("@stdlib/ndarray-base-ind"),Q=require("@stdlib/ndarray-base-ctor"),U=require("@stdlib/string-format"),q=Q.prototype.iset;function W(e,i){if(this._flags.READONLY)throw new Error("invalid invocation. Cannot write to a read-only array.");if(this._ndims>0){if(!J(e))throw new TypeError(U("invalid argument. Index must be an integer. Value: `%s`.",e));e=K(e,this._length-1,this._mode),q.call(this,e,i)}else q.call(this,e);return this}E.exports=W});var O=o(function(Ne,T){"use strict";var Z=require("@stdlib/assert-is-integer").isPrimitive,$=require("@stdlib/ndarray-base-ind"),I=require("@stdlib/string-format");function ee(){var e,i,t,r;if(arguments.length!==this._ndims)throw new RangeError(I("invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.",this._ndims,arguments.length));for(e=this._offset,t=this._submode.length,r=0;r0))throw new TypeError(n("invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.",t));if(s=t.length,s>M)throw new RangeError(n("invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.",M,s));if(!de(r))throw new TypeError(n("invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.",r));if(s>0){if(r.length!==s)throw new RangeError(n("invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.",s,r.length))}else{if(r.length!==1)throw new RangeError("invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.");if(r[0]!==0)throw new RangeError(n("invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.",r[0]))}if(!ge(m))throw new TypeError(n("invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.",m));if(!le(d))throw new TypeError(n("invalid argument. Sixth argument must be a supported order. Value: `%s`.",d));if(s>0&&!ve(i.length,t,r,m)&&fe(t)>0)throw new Error("invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.");if(u={},u.mode=_e,u.readonly=Ie,arguments.length>6&&(h=Ee(u,f),h))throw h;return this._mode=u.mode,u.submode===void 0&&(u.submode=[this._mode]),this._submode=u.submode,c=L(t,s),b=L(r,s||1),z.call(this,e,i,c,b,m,d),this._flags.READONLY=u.readonly,this}be(a,z);l(a,"name","ndarray");l(a.prototype,"get",pe);l(a.prototype,"iget",we);l(a.prototype,"set",qe);l(a.prototype,"iset",ye);S.exports=a});var Te=C();module.exports=Te; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 81910a4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/iget.js", "../lib/iset.js", "../lib/get.js", "../lib/set.js", "../lib/copy_array.js", "../lib/validate.js", "../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar getIndex = require( '@stdlib/ndarray-base-ind' );\nvar parent = require( '@stdlib/ndarray-base-ctor' ); // eslint-disable-line stdlib/no-redeclare\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar base = parent.prototype.iget;\n\n\n// MAIN //\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @throws {TypeError} index must be an integer\n* @throws {RangeError} index exceeds array dimensions\n* @returns {*} array element\n*/\nfunction iget( idx ) {\n\tif ( this._ndims > 0 ) {\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index must be an integer. Value: `%s`.', idx ) );\n\t\t}\n\t\tidx = getIndex( idx, this._length-1, this._mode );\n\t\treturn base.call( this, idx );\n\t}\n\treturn base.call( this );\n}\n\n\n// EXPORTS //\n\nmodule.exports = iget;\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-invalid-this */\n\n'use strict';\n\n// METHODS //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar getIndex = require( '@stdlib/ndarray-base-ind' );\nvar parent = require( '@stdlib/ndarray-base-ctor' ); // eslint-disable-line stdlib/no-redeclare\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar base = parent.prototype.iset;\n\n\n// MAIN //\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @param {*} v - value to set\n* @throws {Error} cannot write to a read-only array\n* @throws {TypeError} index must be an integer\n* @throws {RangeError} index exceeds array dimensions\n* @returns {ndarray} ndarray instance\n*/\nfunction iset( idx, v ) {\n\tif ( this._flags.READONLY ) {\n\t\tthrow new Error( 'invalid invocation. Cannot write to a read-only array.' );\n\t}\n\tif ( this._ndims > 0 ) {\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index must be an integer. Value: `%s`.', idx ) );\n\t\t}\n\t\tidx = getIndex( idx, this._length-1, this._mode );\n\t\tbase.call( this, idx, v );\n\t} else {\n\t\tbase.call( this, idx );\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nmodule.exports = iset;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar getIndex = require( '@stdlib/ndarray-base-ind' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @throws {TypeError} provided indices must be integer valued\n* @throws {RangeError} index exceeds array dimensions\n* @throws {RangeError} number of indices must equal the number of dimensions\n* @returns {*} array element\n*/\nfunction get() {\n\tvar idx;\n\tvar ind;\n\tvar M;\n\tvar i;\n\n\tif ( arguments.length !== this._ndims ) {\n\t\tthrow new RangeError( format( 'invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.', this._ndims, arguments.length ) );\n\t}\n\tidx = this._offset;\n\tM = this._submode.length;\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\tif ( !isInteger( arguments[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Indices must be integer valued. Argument: `%u`. Value: `%s`.', i, arguments[ i ] ) );\n\t\t}\n\t\tind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len\n\t\tidx += this._strides[ i ] * ind;\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( idx );\n\t}\n\treturn this._buffer[ idx ];\n}\n\n\n// EXPORTS //\n\nmodule.exports = get;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar getIndex = require( '@stdlib/ndarray-base-ind' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @throws {Error} cannot write to a read-only array\n* @throws {TypeError} provided indices must be integer valued\n* @throws {RangeError} index exceeds array dimensions\n* @throws {RangeError} number of indices must equal the number of dimensions\n* @returns {ndarray} ndarray instance\n*/\nfunction set() {\n\tvar idx;\n\tvar ind;\n\tvar M;\n\tvar i;\n\n\tif ( this._flags.READONLY ) {\n\t\tthrow new Error( 'invalid invocation. Cannot write to a read-only array.' );\n\t}\n\tif ( arguments.length !== this._ndims+1 ) {\n\t\tthrow new RangeError( format( 'invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.', this._ndims, arguments.length ) );\n\t}\n\tidx = this._offset;\n\tM = this._submode.length;\n\tfor ( i = 0; i < arguments.length-1; i++ ) {\n\t\tif ( !isInteger( arguments[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Indices must be integer valued. Argument: `%i`. Value: `%s`.', i, arguments[ i ] ) );\n\t\t}\n\t\tind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len\n\t\tidx += this._strides[ i ] * ind;\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( arguments[ i ], idx );\n\t} else {\n\t\tthis._buffer[ idx ] = arguments[ i ];\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nmodule.exports = set;\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* Copies the contents of array-like value to a new array.\n*\n* @private\n* @param {ArrayLike} arr - input array\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} output array\n*\n* @example\n* var arr = [ 1.0, 2.0, 3.0 ];\n*\n* var out = copy( arr, arr.length );\n* // returns [ 1.0, 2.0, 3.0 ]\n*\n* var bool = ( arr === out );\n* // returns false\n*/\nfunction copy( arr, len ) {\n\tvar out;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout.push( arr[ i ] );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\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\nvar isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );\nvar isIndexMode = require( '@stdlib/ndarray-base-assert-is-index-mode' );\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.mode] - specifies how to handle indices which exceed array dimensions\n* @param {StringArray} [options.submode] - specifies how to handle subscripts which exceed array dimensions\n* @param {boolean} [options.readonly] - boolean indicating whether an array should be read-only\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'mode': 'clamp',\n* 'submode': [ 'throw', 'wrap', 'clamp' ]\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\topts.mode = options.mode;\n\t\tif ( !isIndexMode( opts.mode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a recognized mode. Option: `%s`.', 'mode', opts.mode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'submode' ) ) {\n\t\topts.submode = options.submode;\n\t\tif ( !isArrayLikeObject( opts.submode ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode ) );\n\t\t}\n\t\tif ( opts.submode.length === 0 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode.join( ',' ) ) );\n\t\t}\n\t\tfor ( i = 0; i < opts.submode.length; i++ ) {\n\t\t\tif ( !isIndexMode( opts.submode[ i ] ) ) {\n\t\t\t\treturn new TypeError( format( 'invalid option. Each submode must be a recognized mode. Option: `%s`.', opts.submode[ i ] ) );\n\t\t\t}\n\t\t}\n\t\topts.submode = opts.submode.slice();\n\t}\n\tif ( hasOwnProp( options, 'readonly' ) ) {\n\t\topts.readonly = options.readonly;\n\t\tif ( !isBoolean( opts.readonly ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', opts.readonly ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isNonNegativeIntegerArray = require( '@stdlib/assert-is-nonnegative-integer-array' ).primitives;\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isIntegerArray = require( '@stdlib/assert-is-integer-array' ).primitives;\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isOrder = require( '@stdlib/ndarray-base-assert-is-order' );\nvar isDataType = require( '@stdlib/ndarray-base-assert-is-data-type' );\nvar isBufferLengthCompatible = require( '@stdlib/ndarray-base-assert-is-buffer-length-compatible' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar parent = require( '@stdlib/ndarray-base-ctor' ); // eslint-disable-line stdlib/no-redeclare\nvar defaults = require( '@stdlib/ndarray-defaults' );\nvar inherit = require( '@stdlib/utils-inherit' );\nvar format = require( '@stdlib/string-format' );\nvar iget = require( './iget.js' );\nvar iset = require( './iset.js' );\nvar get = require( './get.js' );\nvar set = require( './set.js' );\nvar copy = require( './copy_array.js' );\nvar validate = require( './validate.js' );\n\n\n// VARIABLES //\n\n/*\n* See the following references:\n*\n* - https://stackoverflow.com/questions/22747068/is-there-a-max-number-of-arguments-javascript-functions-can-accept\n* - https://bugs.webkit.org/show_bug.cgi?id=80797\n* - https://github.com/numpy/numpy/issues/5744\n*\n* Note that the maximum number of function arguments can vary from engine to engine. Here, we choose something of a lowest common denominator which may **not** be valid everywhere.\n*/\nvar MAX_DIMS = 32767|0;\n\nvar INDEX_MODE = defaults.get( 'index_mode' );\nvar READONLY = false;\n\n\n// MAIN //\n\n/**\n* ndarray constructor.\n*\n* @constructor\n* @param {string} dtype - data type\n* @param {Collection} buffer - data buffer\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - array strides\n* @param {NonNegativeInteger} offset - index offset\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {Options} [options] - function options\n* @param {string} [options.mode=\"throw\"] - specifies how to handle indices which exceed array dimensions\n* @param {StringArray} [options.submode=[\"throw\"]] - specifies how to handle subscripts which exceed array dimensions on a per dimension basis\n* @param {boolean} [options.readonly=false] - boolean indicating whether an array should be read-only\n* @throws {TypeError} `dtype` argument must be a supported ndarray data type\n* @throws {TypeError} `buffer` argument must be an array-like object, typed-array-like, or a Buffer\n* @throws {TypeError} `buffer` argument `get` and `set` properties must be functions\n* @throws {TypeError} `shape` argument must be an array-like object containing nonnegative integers\n* @throws {Error} `shape` argument length must equal the number of dimensions\n* @throws {TypeError} `strides` argument must be an array-like object containing integers\n* @throws {Error} `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`)\n* @throws {Error} for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0`\n* @throws {TypeError} `offset` argument must be a nonnegative integer\n* @throws {TypeError} `order` argument must be a supported ndarray order\n* @throws {Error} `buffer` argument must be compatible with specified meta data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} too many dimensions\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*/\nfunction ndarray( dtype, buffer, shape, strides, offset, order, options ) {\n\tvar ndims;\n\tvar opts;\n\tvar err;\n\tvar sh;\n\tvar st;\n\n\tif ( !(this instanceof ndarray) ) {\n\t\tif ( arguments.length < 7 ) {\n\t\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order );\n\t\t}\n\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order, options ); // eslint-disable-line max-len\n\t}\n\tif ( !isDataType( dtype ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported ndarray data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( !isCollection( buffer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object, typed-array-like, or a Buffer. Value: `%s`.', buffer ) );\n\t} else if ( buffer.get && buffer.set && ( !isFunction( buffer.get ) || !isFunction( buffer.set ) ) ) { // eslint-disable-line max-len\n\t\tthrow new TypeError( format( 'invalid argument. Second argument `get` and `set` properties must be functions. Value: `%s`.', buffer ) );\n\t}\n\tif ( !isNonNegativeIntegerArray( shape ) ) {\n\t\tif ( !isCollection( shape) || shape.length > 0 ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.', shape ) );\n\t\t}\n\t}\n\tndims = shape.length;\n\tif ( ndims > MAX_DIMS ) {\n\t\tthrow new RangeError( format( 'invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.', MAX_DIMS, ndims ) );\n\t}\n\tif ( !isIntegerArray( strides ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.', strides ) );\n\t}\n\tif ( ndims > 0 ) {\n\t\tif ( strides.length !== ndims ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.', ndims, strides.length ) );\n\t\t}\n\t} else if ( strides.length !== 1 ) {\n\t\tthrow new RangeError( 'invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.' );\n\t} else if ( strides[ 0 ] !== 0 ) {\n\t\tthrow new RangeError( format( 'invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.', strides[ 0 ] ) );\n\t}\n\tif ( !isNonNegativeInteger( offset ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.', offset ) );\n\t}\n\tif ( !isOrder( order ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Sixth argument must be a supported order. Value: `%s`.', order ) );\n\t}\n\tif ( ndims > 0 && !isBufferLengthCompatible( buffer.length, shape, strides, offset ) && numel( shape ) > 0 ) { // eslint-disable-line max-len\n\t\tthrow new Error( 'invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.' );\n\t}\n\topts = {};\n\topts.mode = INDEX_MODE;\n\topts.readonly = READONLY;\n\tif ( arguments.length > 6 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tthis._mode = opts.mode;\n\tif ( opts.submode === void 0 ) {\n\t\topts.submode = [ this._mode ];\n\t}\n\tthis._submode = opts.submode;\n\n\t// Copy `shape` and `strides` to prevent external mutation:\n\tsh = copy( shape, ndims );\n\tst = copy( strides, ndims || 1 );\n\n\t// Call the parent constructor:\n\tparent.call( this, dtype, buffer, sh, st, offset, order );\n\tthis._flags.READONLY = opts.readonly;\n\n\treturn this;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n// Inherit from the parent constructor:\ninherit( ndarray, parent );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof ndarray\n* @type {string}\n* @default 'ndarray'\n*\n* @example\n* var str = ndarray.name;\n* // returns 'ndarray'\n*/\nsetReadOnly( ndarray, 'name', 'ndarray' );\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name get\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'get', get );\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @name iget\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'iget', iget );\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name set\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*\n* x.set( 1, 1, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.get( 1, 1 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'set', set );\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @name iset\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*\n* x.iset( 3, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.iget( 3 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'iset', iset );\n\n\n// EXPORTS //\n\nmodule.exports = ndarray;\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* Multidimensional array constructor.\n*\n* @module @stdlib/ndarray-ctor\n*\n* @example\n* var ndarray = require( '@stdlib/ndarray-ctor' );\n*\n* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAwBA,IAAIC,EAAY,QAAS,2BAA4B,EAAE,YAC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E,EAAQ,GAAK,CAACvB,GAA0BiB,EAAO,OAAQC,EAAOC,EAASC,CAAO,GAAKnB,GAAOiB,CAAM,EAAI,EACxG,MAAM,IAAI,MAAO,4NAA6N,EAK/O,GAHAM,EAAO,CAAC,EACRA,EAAK,KAAOX,GACZW,EAAK,SAAWV,GACX,UAAU,OAAS,IACvBW,EAAMd,GAAUa,EAAMF,CAAQ,EACzBG,GACJ,MAAMA,EAGR,YAAK,MAAQD,EAAK,KACbA,EAAK,UAAY,SACrBA,EAAK,QAAU,CAAE,KAAK,KAAM,GAE7B,KAAK,SAAWA,EAAK,QAGrBE,EAAKhB,EAAMQ,EAAOK,CAAM,EACxBI,EAAKjB,EAAMS,EAASI,GAAS,CAAE,EAG/BrB,EAAO,KAAM,KAAMc,EAAOC,EAAQS,EAAIC,EAAIP,EAAQC,CAAM,EACxD,KAAK,OAAO,SAAWG,EAAK,SAErB,IAGR,CAGApB,GAASW,EAASb,CAAO,EAczBV,EAAauB,EAAS,OAAQ,SAAU,EA0BxCvB,EAAauB,EAAQ,UAAW,MAAOP,EAAI,EA0B3ChB,EAAauB,EAAQ,UAAW,OAAQT,EAAK,EAmC7Cd,EAAauB,EAAQ,UAAW,MAAON,EAAI,EAmC3CjB,EAAauB,EAAQ,UAAW,OAAQR,EAAK,EAK7ChB,EAAO,QAAUwB,IC9RjB,IAAIa,GAAO,IAKX,OAAO,QAAUA", - "names": ["require_iget", "__commonJSMin", "exports", "module", "isInteger", "getIndex", "parent", "format", "base", "iget", "idx", "require_iset", "__commonJSMin", "exports", "module", "isInteger", "getIndex", "parent", "format", "base", "iset", "idx", "v", "require_get", "__commonJSMin", "exports", "module", "isInteger", "getIndex", "format", "get", "idx", "ind", "M", "i", "require_set", "__commonJSMin", "exports", "module", "isInteger", "getIndex", "format", "set", "idx", "ind", "M", "i", "require_copy_array", "__commonJSMin", "exports", "module", "copy", "arr", "len", "out", "i", "require_validate", "__commonJSMin", "exports", "module", "isObject", "hasOwnProp", "isArrayLikeObject", "isIndexMode", "isBoolean", "format", "validate", "opts", "options", "i", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "isCollection", "isNonNegativeIntegerArray", "isNonNegativeInteger", "isIntegerArray", "isFunction", "isOrder", "isDataType", "isBufferLengthCompatible", "numel", "parent", "defaults", "inherit", "format", "iget", "iset", "get", "set", "copy", "validate", "MAX_DIMS", "INDEX_MODE", "READONLY", "ndarray", "dtype", "buffer", "shape", "strides", "offset", "order", "options", "ndims", "opts", "err", "sh", "st", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 87b9798..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,474 +0,0 @@ - -{{alias}}( dtype, buffer, shape, strides, offset, order[, options] ) - Returns an ndarray. - - Parameters - ---------- - dtype: string - Underlying data type. - - buffer: ArrayLikeObject|TypedArray|Buffer - Data buffer. A data buffer must be an array-like object (i.e., have a - `length` property). For data buffers which are not indexed collections - (i.e., collections which cannot support direct index access, such as - `buffer[ index ]`; e.g., Complex64Array, Complex128Array, etc), a data - buffer should provide `#.get( idx )` and `#.set( v[, idx] )` methods. - Note that, for `set` methods, the value to set should be the first - argument, followed by the linear index, similar to the native typed - array `set` method. - - shape: ArrayLikeObject - Array shape. - - strides: ArrayLikeObject - Array strides. - - offset: integer - Index offset. - - order: string - Specifies whether an array is row-major (C-style) or column-major - (Fortran-style). - - options: Object (optional) - Options. - - options.mode: string (optional) - Specifies how to handle indices which exceed array dimensions. If equal - to 'throw', an ndarray instance throws an error when an index exceeds - array dimensions. If equal to 'normalize', an ndarray instance - normalizes negative indices and throws an error when an index exceeds - array dimensions. If equal to 'wrap', an ndarray instance wraps around - indices exceeding array dimensions using modulo arithmetic. If equal to - 'clamp', an ndarray instance sets an index exceeding array dimensions - to either `0` (minimum index) or the maximum index. Default: 'throw'. - - options.submode: Array (optional) - Specifies how to handle subscripts which exceed array dimensions. If a - mode for a corresponding dimension is equal to 'throw', an ndarray - instance throws an error when a subscript exceeds array dimensions. If - equal to 'normalize', an ndarray instance normalizes negative - subscripts and throws an error when a subscript exceeds array - dimensions. If equal to 'wrap', an ndarray instance wraps around - subscripts exceeding array dimensions using modulo arithmetic. If equal - to 'clamp', an ndarray instance sets a subscript exceeding array - dimensions to either `0` (minimum index) or the maximum index. If the - number of modes is fewer than the number of dimensions, the function - recycles modes using modulo arithmetic. Default: [ options.mode ]. - - options.readonly: boolean (optional) - Boolean indicating whether an array should be read-only. Default: false. - - Returns - ------- - ndarray: ndarray - ndarray instance. - - Examples - -------- - // Create a new instance... - > var b = [ 1.0, 2.0, 3.0, 4.0 ]; // underlying data buffer - > var d = [ 2, 2 ]; // shape - > var s = [ 2, 1 ]; // strides - > var o = 0; // index offset - > var arr = {{alias}}( 'generic', b, d, s, o, 'row-major' ) - - - // Get an element using subscripts: - > var v = arr.get( 1, 1 ) - 4.0 - - // Get an element using a linear index: - > v = arr.iget( 3 ) - 4.0 - - // Set an element using subscripts: - > arr.set( 1, 1, 40.0 ); - > arr.get( 1, 1 ) - 40.0 - - // Set an element using a linear index: - > arr.iset( 3, 99.0 ); - > arr.get( 1, 1 ) - 99.0 - - -{{alias}}.prototype.byteLength - Size (in bytes) of the array (if known). - - Returns - ------- - size: integer|null - Size (in bytes) of the array. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var sz = arr.byteLength - 32 - - -{{alias}}.prototype.BYTES_PER_ELEMENT - Size (in bytes) of each array element (if known). - - Returns - ------- - size: integer|null - Size (in bytes) of each array element. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var sz = arr.BYTES_PER_ELEMENT - 8 - - -{{alias}}.prototype.data - Pointer to the underlying data buffer. - - Returns - ------- - buf: ArrayLikeObject|TypedArray|Buffer - Underlying data buffer. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var buf = arr.data - [ 1.0, 2.0, 3.0, 4.0 ] - - -{{alias}}.prototype.dtype - Underlying data type. - - Returns - ------- - dtype: string - Underlying data type. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var dt = arr.dtype - 'float64' - - -{{alias}}.prototype.flags - Meta information, such as information concerning the memory layout of the - array. - - Returns - ------- - flags: Object - Info object. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var fl = arr.flags - {...} - - -{{alias}}.prototype.length - Length of the array (i.e., number of elements). - - Returns - ------- - len: integer - Array length. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var len = arr.length - 4 - - -{{alias}}.prototype.ndims - Number of dimensions. - - Returns - ------- - ndims: integer - Number of dimensions. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var n = arr.ndims - 2 - - -{{alias}}.prototype.offset - Index offset which specifies the buffer index at which to start iterating - over array elements. - - Returns - ------- - offset: integer - Index offset. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var v = arr.offset - 0 - - -{{alias}}.prototype.order - Array order. - - The array order is either row-major (C-style) or column-major (Fortran- - style). - - Returns - ------- - order: string - Array order. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var ord = arr.order - 'row-major' - - -{{alias}}.prototype.shape - Array shape. - - Returns - ------- - shape: Array - Array shape. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var sh = arr.shape - [ 2, 2 ] - - -{{alias}}.prototype.strides - Index strides which specify how to access data along corresponding array - dimensions. - - Returns - ------- - strides: Array - Index strides. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var st = arr.strides - [ 2, 1 ] - - -{{alias}}.prototype.get( ...idx ) - Returns an array element specified according to provided subscripts. - - The number of provided subscripts should equal the number of dimensions. - - For zero-dimensional arrays, no indices should be provided. - - Parameters - ---------- - idx: ...integer - Subscripts. - - Returns - ------- - out: any - Array element. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var v = arr.get( 1, 1 ) - 4.0 - - -{{alias}}.prototype.iget( idx ) - Returns an array element located at a specified linear index. - - For zero-dimensional arrays, the input argument is ignored and, for clarity, - should not be provided. - - Parameters - ---------- - idx: integer - Linear index. - - Returns - ------- - out: any - Array element. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > var v = arr.iget( 3 ) - 4.0 - - -{{alias}}.prototype.set( ...idx, v ) - Sets an array element specified according to provided subscripts. - - The number of provided subscripts should equal the number of dimensions. - - For zero-dimensional arrays, no indices should be provided. - - Parameters - ---------- - idx: ...integer - Subscripts. - - v: any - Value to set. - - Returns - ------- - out: ndarray - ndarray instance. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > arr.set( 1, 1, -4.0 ); - > arr.get( 1, 1 ) - -4.0 - - -{{alias}}.prototype.iset( idx, v ) - Sets an array element located at a specified linear index. - - For zero-dimensional arrays, the first, and only, argument should be the - value to set. - - Parameters - ---------- - idx: integer - Linear index. - - v: any - Value to set. - - Returns - ------- - out: ndarray - ndarray instance. - - Examples - -------- - > var b = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'float64', b, d, s, o, 'row-major' ); - > arr.iset( 3, -4.0 ); - > arr.iget( 3 ) - -4.0 - - -{{alias}}.prototype.toString() - Serializes an ndarray as a string. - - This method does **not** serialize data outside of the buffer region defined - by the array configuration. - - Returns - ------- - str: string - Serialized ndarray string. - - Examples - -------- - > var b = [ 1, 2, 3, 4 ]; - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'generic', b, d, s, o, 'row-major' ); - > arr.toString() - '...' - - -{{alias}}.prototype.toJSON() - Serializes an ndarray as a JSON object. - - This method does **not** serialize data outside of the buffer region defined - by the array configuration. - - Returns - ------- - obj: Object - JSON object. - - Examples - -------- - > var b = [ 1, 2, 3, 4 ]; - > var d = [ 2, 2 ]; - > var s = [ 2, 1 ]; - > var o = 0; - > var arr = {{alias}}( 'generic', b, d, s, o, 'row-major' ); - > arr.toJSON() - {...} - - See Also - -------- - diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index 3318045..0000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,160 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Collection, ArrayLike } from '@stdlib/types/array'; -import { ndarray, DataType, Mode, Order, Shape, Strides } from '@stdlib/types/ndarray'; -import { Buffer } from 'buffer'; - -/** -* Interface defining function options. -*/ -interface Options { - /** - * Specifies how to handle a linear index which exceeds array dimensions (default: 'throw'). - */ - mode?: Mode; - - /** - * Specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']). - */ - submode?: ArrayLike; - - /** - * Boolean indicating whether an array should be read-only (default: false). - */ - readonly?: boolean; -} - -/** -* Interface defining a ndarray constructor which is both "newable" and "callable". -*/ -interface Constructor { - /** - * ndarray constructor. - * - * @param dtype - data type - * @param buffer - data buffer - * @param shape - array shape - * @param strides - array strides - * @param offset - index offset - * @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) - * @param options - function options - * @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw') - * @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']) - * @param options.readonly - specifies whether an array should be read-only (default: false) - * @throws `buffer` argument `get` and `set` properties must be functions - * @throws `shape` argument must be an array-like object containing nonnegative integers - * @throws `shape` argument length must equal the number of dimensions - * @throws `strides` argument must be an array-like object containing integers - * @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`) - * @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0` - * @throws `offset` argument must be a nonnegative integer - * @throws `buffer` argument must be compatible with specified meta data - * @throws must provide valid options - * @throws too many dimensions - * @returns ndarray instance - * - * @example - * var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; - * var shape = [ 3, 2 ]; - * var strides = [ 2, 1 ]; - * var offset = 0; - * - * var out = new ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); - */ - new ( dtype: DataType, buffer: Collection | Buffer, shape: Shape, strides: Strides, offset: number, order: Order, options?: Options ): ndarray; - - /** - * ndarray constructor. - * - * @param dtype - data type - * @param buffer - data buffer - * @param shape - array shape - * @param strides - array strides - * @param offset - index offset - * @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) - * @param options - function options - * @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw') - * @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']) - * @param options.readonly - specifies whether an array should be read-only (default: false) - * @throws `buffer` argument `get` and `set` properties must be functions - * @throws `shape` argument must be an array-like object containing nonnegative integers - * @throws `shape` argument length must equal the number of dimensions - * @throws `strides` argument must be an array-like object containing integers - * @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`) - * @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0` - * @throws `offset` argument must be a nonnegative integer - * @throws `buffer` argument must be compatible with specified meta data - * @throws must provide valid options - * @throws too many dimensions - * @returns ndarray instance - * - * @example - * var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; - * var shape = [ 3, 2 ]; - * var strides = [ 2, 1 ]; - * var offset = 0; - * - * var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); - */ - ( dtype: DataType, buffer: Collection | Buffer, shape: Shape, strides: Strides, offset: number, order: Order, options?: Options ): ndarray; -} - -/** -* ndarray constructor. -* -* @param dtype - data type -* @param buffer - data buffer -* @param shape - array shape -* @param strides - array strides -* @param offset - index offset -* @param order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) -* @param options - function options -* @param options.mode - specifies how to handle indices which exceed array dimensions (default: 'throw') -* @param options.submode - specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']) -* @param options.readonly - specifies whether an array should be read-only (default: false) -* @throws `buffer` argument `get` and `set` properties must be functions -* @throws `shape` argument must be an array-like object containing nonnegative integers -* @throws `shape` argument length must equal the number of dimensions -* @throws `strides` argument must be an array-like object containing integers -* @throws `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`) -* @throws for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0` -* @throws `offset` argument must be a nonnegative integer -* @throws `buffer` argument must be compatible with specified meta data -* @throws must provide valid options -* @throws too many dimensions -* @returns ndarray instance -* -* @example -* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -*/ -declare var ctor: Constructor; - - -// EXPORTS // - -export = ctor; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 5346156..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 ndarray = require( './index' ); - - -// TESTS // - -// The function returns an ndarray... -{ - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - - let x = ndarray( 'float64', [ 1, 2, 3, 4 ], shape, strides, 0, 'row-major' ); // $ExpectType ndarray - x = new ndarray( 'float64', [ 1, 2, 3, 4 ], shape, strides, 0, 'row-major' ); // $ExpectType ndarray - - const buffer = new Int32Array( [ 1, 2, 3 ] ); - const order = 'column-major'; - - x = ndarray( 'int32', buffer, shape, strides, 0, order ); // $ExpectType ndarray - x = new ndarray( 'int32', buffer, shape, strides, 0, order ); // $ExpectType ndarray - - x = ndarray( 'int32', buffer, shape, strides, 0, order, { 'mode': 'clamp' } ); // $ExpectType ndarray - x = new ndarray( 'int32', buffer, shape, strides, 0, order, { 'mode': 'clamp' } ); // $ExpectType ndarray - - x = ndarray( 'int32', buffer, shape, strides, 0, order, { 'submode': [ 'throw' ] } ); // $ExpectType ndarray - x = new ndarray( 'int32', buffer, shape, strides, 0, order, { 'submode': [ 'throw' ] } ); // $ExpectType ndarray - - if ( x.shape[ 0 ] !== x.shape[ 0 ] ) { - throw new Error( 'unexpected error' ); - } -} - -// The compiler throws an error if the function is provided a first argument which is not a recognized data type... -{ - const buffer = [ 1, 2, 3, 4 ]; - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - const order = 'row-major'; - - ndarray( 'abc', buffer, shape, strides, offset, order ); // $ExpectError - ndarray( 123, buffer, shape, strides, offset, order ); // $ExpectError - ndarray( true, buffer, shape, strides, offset, order ); // $ExpectError - ndarray( false, buffer, shape, strides, offset, order ); // $ExpectError - ndarray( null, buffer, shape, strides, offset, order ); // $ExpectError - ndarray( undefined, buffer, shape, strides, offset, order ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not an array-like object or buffer... -{ - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - const order = 'row-major'; - ndarray( 'float64', 123, shape, strides, offset, order ); // $ExpectError - ndarray( 'float64', true, shape, strides, offset, order ); // $ExpectError - ndarray( 'float64', false, shape, strides, offset, order ); // $ExpectError - ndarray( 'float64', null, shape, strides, offset, order ); // $ExpectError - ndarray( 'float64', undefined, shape, strides, offset, order ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not an array-like object containing numbers... -{ - const buffer = [ 1, 2, 3, 4 ]; - const strides = [ 2, 1 ]; - const offset = 0; - const order = 'row-major'; - ndarray( 'float64', buffer, true, strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, false, strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, null, strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, undefined, strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, '5', strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, [ '1', '2' ], strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, {}, strides, offset, order ); // $ExpectError - ndarray( 'float64', buffer, ( x: number ): number => x, strides, offset, order ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fourth argument which is not an array-like object containing numbers... -{ - const buffer = [ 1, 2, 3, 4 ]; - const shape = [ 2, 2 ]; - const offset = 0; - const order = 'row-major'; - ndarray( 'float32', buffer, shape, true, offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, false, offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, null, offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, undefined, offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, '5', offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, [ '1', '2' ], offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, {}, offset, order ); // $ExpectError - ndarray( 'float32', buffer, shape, ( x: number ): number => x, offset, order ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fifth argument which is not a number... -{ - const buffer = [ 1, 2, 3, 4 ]; - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const order = 'row-major'; - ndarray( 'int32', buffer, shape, strides, true, order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, false, order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, null, order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, undefined, order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, '5', order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, [ '1', '2' ], order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, {}, order ); // $ExpectError - ndarray( 'int32', buffer, shape, strides, ( x: number ): number => x, order ); // $ExpectError -} - -// The compiler throws an error if the function is provided a sixth argument which is not a known array order... -{ - const buffer = [ 1, 2, 3, 4 ]; - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - ndarray( 'int8', buffer, shape, strides, offset, true ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, false ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, null ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, undefined ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, '5' ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, [ '1', '2' ] ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, {} ); // $ExpectError - ndarray( 'int8', buffer, shape, strides, offset, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `mode` option which is not a recognized mode... -{ - const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - const order = 'row-major'; - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': 'abc' } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': 123 } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': true } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': false } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': null } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': [] } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': {} } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'mode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided an `submode` option which is not an ndarray of strings... -{ - const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - const order = 'row-major'; - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': 'abc' } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': 123 } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': true } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': false } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': null } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': {} } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'submode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `readonly` option which is not a boolean... -{ - const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - const order = 'row-major'; - ndarray( 'float64', buffer, shape, strides, offset, order, { 'readonly': 'abc' } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'readonly': 123 } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'readonly': [] } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'readonly': null } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'readonly': {} } ); // $ExpectError - ndarray( 'float64', buffer, shape, strides, offset, order, { 'readonly': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided and invalid number of arguments... -{ - const buffer = [ 1, 2, 3, 4 ]; - const shape = [ 2, 2 ]; - const strides = [ 2, 1 ]; - const offset = 0; - ndarray(); // $ExpectError - ndarray( 'uint32' ); // $ExpectError - ndarray( 'int8', buffer ); // $ExpectError - ndarray( 'uint8c', buffer, shape ); // $ExpectError - ndarray( 'uint8', buffer, shape, strides ); // $ExpectError - ndarray( 'uint16', buffer, shape, strides, offset ); // $ExpectError - ndarray( 'uint16', buffer, shape, strides, offset, 'row-major', {}, {} ); // $ExpectError -} diff --git a/examples/c/Makefile b/examples/c/Makefile deleted file mode 100644 index 95c1664..0000000 --- a/examples/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 := example.out - - -# RULES # - -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ -all: $(c_targets) - -.PHONY: all - -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ -$(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) - -#/ -# Runs compiled examples. -# -# @example -# make run -#/ -run: $(c_targets) - $(QUIET) ./$< - -.PHONY: run - -#/ -# Removes generated files. -# -# @example -# make clean -#/ -clean: - $(QUIET) -rm -f *.o *.out - -.PHONY: clean diff --git a/examples/c/example.c b/examples/c/example.c deleted file mode 100644 index 1f6cc96..0000000 --- a/examples/c/example.c +++ /dev/null @@ -1,206 +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 "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 = %d\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 = %d\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; // cppcheck-suppress invalidPointerCast - - 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; // cppcheck-suppress invalidPointerCast - - 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; // cppcheck-suppress invalidPointerCast - - // 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 ); -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index afbf4fd..0000000 --- a/examples/index.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Float32Array = require( '@stdlib/array-float32' ); -var ndarray = require( './../lib' ); - -// Create a data buffer: -var buffer = new Float32Array( (3*3*3*3) + 100 ); - -// Specify the array shape: -var shape = [ 3, 3, 3, 3 ]; - -// Specify the array strides: -var strides = [ 27, 9, 3, 1 ]; - -// Specify the index offset: -var offset = 4; - -// Specify the order: -var order = 'row-major'; // C-style - -// Create a new ndarray: -var arr = ndarray( 'float32', buffer, shape, strides, offset, order ); - -// Retrieve an array value: -var v = arr.get( 1, 2, 1, 2 ); -console.log( v ); -// => 0.0 - -// Set an array value: -arr.set( 1, 2, 1, 2, 10.0 ); - -// Retrieve the array value: -v = arr.get( 1, 2, 1, 2 ); -console.log( v ); -// => 10.0 - -// Serialize the array as a string: -console.log( arr.toString() ); -// => "ndarray( 'float32', new Float32Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ), [ 3, 3, 3, 3 ], [ 27, 9, 3, 1 ], 0, 'row-major' )" - -// Serialize the array as JSON: -console.log( JSON.stringify( arr.toJSON() ) ); -// e.g., => '{"type":"ndarray","dtype":"float32","flags":{"READONLY":false},"order":"row-major","shape":[3,3,3,3],"strides":[27,9,3,1],"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}' diff --git a/include/stdlib/ndarray/ctor.h b/include/stdlib/ndarray/ctor.h deleted file mode 100644 index df8053b..0000000 --- a/include/stdlib/ndarray/ctor.h +++ /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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_H -#define STDLIB_NDARRAY_CTOR_H - -#include - -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" - -// The following #includes contain additional APIs which should be exposed along with the prototypes contained in this file... -#include "ctor/get.h" -#include "ctor/get_ptr.h" -#include "ctor/iget.h" -#include "ctor/iget_ptr.h" -#include "ctor/iset.h" -#include "ctor/macros.h" -#include "ctor/ndarray.h" -#include "ctor/set.h" -#include "ctor/set_ptr.h" - -// NOTE: keep declarations in alphabetical order... - -/** -* Returns a pointer to a dynamically allocated ndarray. -*/ -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 ); - -/** -* Returns the size of an ndarray (in bytes). -*/ -int64_t stdlib_ndarray_bytelength( const struct ndarray *arr ); - -/** -* Returns a pointer to an ndarray's underlying byte array. -*/ -uint8_t * stdlib_ndarray_data( const struct ndarray *arr ); - -/** -* Returns an ndarray dimension. -*/ -int64_t stdlib_ndarray_dimension( const struct ndarray *arr, const int64_t i ); - -/** -* Disables specified ndarray flags. -*/ -int8_t stdlib_ndarray_disable_flags( struct ndarray *arr, const int64_t flags ); - -/** -* Returns an ndarray data type. -*/ -int16_t stdlib_ndarray_dtype( const struct ndarray *arr ); - -/** -* Enables specified ndarray flags. -*/ -int8_t stdlib_ndarray_enable_flags( struct ndarray *arr, const int64_t flags ); - -/** -* Returns ndarray flags. -*/ -int64_t stdlib_ndarray_flags( const struct ndarray *arr ); - -/** -* Frees an ndarray's allocated memory. -*/ -void stdlib_ndarray_free( struct ndarray *arr ); - -/** -* Tests whether an ndarray has specified flags enabled. -*/ -int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags ); - -/** -* Returns the index mode of an ndarray. -*/ -int8_t stdlib_ndarray_index_mode( const struct ndarray *arr ); - -/** -* Returns the number of elements in an ndarray. -*/ -int64_t stdlib_ndarray_length( const struct ndarray *arr ); - -/** -* Returns the number of ndarray dimensions. -*/ -int64_t stdlib_ndarray_ndims( const struct ndarray *arr ); - -/** -* Returns an ndarray index offset (in bytes). -*/ -int64_t stdlib_ndarray_offset( const struct ndarray *arr ); - -/** -* Returns the order of an ndarray. -*/ -int8_t stdlib_ndarray_order( const struct ndarray *arr ); - -/** -* Returns the number of ndarray subscript modes. -*/ -int64_t stdlib_ndarray_nsubmodes( const struct ndarray *arr ); - -/** -* Returns a pointer to an array containing an ndarray shape (dimensions). -*/ -int64_t * stdlib_ndarray_shape( const struct ndarray *arr ); - -/** -* Returns an ndarray stride (in bytes). -*/ -int64_t stdlib_ndarray_stride( const struct ndarray *arr, const int64_t i ); - -/** -* Returns a pointer to an array containing ndarray strides (in bytes). -*/ -int64_t * stdlib_ndarray_strides( const struct ndarray *arr ); - -/** -* Returns ndarray subscript modes. -*/ -int8_t * stdlib_ndarray_submodes( const struct ndarray *arr ); - -/** -* Returns an ndarray subscript mode. -*/ -int8_t stdlib_ndarray_submode( const struct ndarray *arr, const int64_t i ); - -#endif // !STDLIB_NDARRAY_CTOR_H diff --git a/include/stdlib/ndarray/ctor/get.h b/include/stdlib/ndarray/ctor/get.h deleted file mode 100644 index c900457..0000000 --- a/include/stdlib/ndarray/ctor/get.h +++ /dev/null @@ -1,98 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_GET_H -#define STDLIB_NDARRAY_CTOR_GET_H - -#include "ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Returns an ndarray data element. -*/ -int8_t stdlib_ndarray_get( const struct ndarray *arr, const int64_t *sub, void *out ); - -/** -* Returns a double-precision floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_get_float64( const struct ndarray *arr, const int64_t *sub, double *out ); - -/** -* Returns a single-precision floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_get_float32( const struct ndarray *arr, const int64_t *sub, float *out ); - -/** -* Returns an unsigned 64-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_uint64( const struct ndarray *arr, const int64_t *sub, uint64_t *out ); - -/** -* Returns a signed 64-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_int64( const struct ndarray *arr, const int64_t *sub, int64_t *out ); - -/** -* Returns an unsigned 32-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_uint32( const struct ndarray *arr, const int64_t *sub, uint32_t *out ); - -/** -* Returns a signed 32-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_int32( const struct ndarray *arr, const int64_t *sub, int32_t *out ); - -/** -* Returns an unsigned 16-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_uint16( const struct ndarray *arr, const int64_t *sub, uint16_t *out ); - -/** -* Returns a signed 16-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_int16( const struct ndarray *arr, const int64_t *sub, int16_t *out ); - -/** -* Returns an unsigned 8-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_uint8( const struct ndarray *arr, const int64_t *sub, uint8_t *out ); - -/** -* Returns a signed 8-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_get_int8( const struct ndarray *arr, const int64_t *sub, int8_t *out ); - -/** -* Returns a double-precision complex floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_get_complex128( const struct ndarray *arr, const int64_t *sub, stdlib_complex128_t *out ); - -/** -* Returns a single-precision complex floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_get_complex64( const struct ndarray *arr, const int64_t *sub, stdlib_complex64_t *out ); - -/** -* Returns a boolean ndarray data element. -*/ -int8_t stdlib_ndarray_get_bool( const struct ndarray *arr, const int64_t *sub, bool *out ); - -#endif // !STDLIB_NDARRAY_CTOR_GET_H diff --git a/include/stdlib/ndarray/ctor/get_ptr.h b/include/stdlib/ndarray/ctor/get_ptr.h deleted file mode 100644 index d0093ca..0000000 --- a/include/stdlib/ndarray/ctor/get_ptr.h +++ /dev/null @@ -1,103 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_GET_PTR_H -#define STDLIB_NDARRAY_CTOR_GET_PTR_H - -#include "ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Returns a pointer to an ndarray data element in the underlying byte array. -*/ -uint8_t * stdlib_ndarray_get_ptr( const struct ndarray *arr, const int64_t *sub ); - -/** -* Returns an ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_value( const struct ndarray *arr, const uint8_t *idx, void *out ); - -/** -* Returns a double-precision floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_float64( const uint8_t *idx, double *out ); - -/** -* Returns a single-precision floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_float32( const uint8_t *idx, float *out ); - -/** -* Returns an unsigned 64-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_uint64( const uint8_t *idx, uint64_t *out ); - -/** -* Returns a signed 64-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_int64( const uint8_t *idx, int64_t *out ); - -/** -* Returns an unsigned 32-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_uint32( const uint8_t *idx, uint32_t *out ); - -/** -* Returns a signed 32-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_int32( const uint8_t *idx, int32_t *out ); - -/** -* Returns an unsigned 16-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_uint16( const uint8_t *idx, uint16_t *out ); - -/** -* Returns a signed 16-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_int16( const uint8_t *idx, int16_t *out ); - -/** -* Returns an unsigned 8-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_uint8( const uint8_t *idx, uint8_t *out ); - -/** -* Returns a signed 8-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_int8( const uint8_t *idx, int8_t *out ); - -/** -* Returns a double-precision complex floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_complex128( const uint8_t *idx, stdlib_complex128_t *out ); - -/** -* Returns a single-precision complex floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_complex64( const uint8_t *idx, stdlib_complex64_t *out ); - -/** -* Returns a boolean ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_get_ptr_bool( const uint8_t *idx, bool *out ); - -#endif // !STDLIB_NDARRAY_CTOR_GET_PTR_H diff --git a/include/stdlib/ndarray/ctor/iget.h b/include/stdlib/ndarray/ctor/iget.h deleted file mode 100644 index 074e575..0000000 --- a/include/stdlib/ndarray/ctor/iget.h +++ /dev/null @@ -1,98 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_IGET_H -#define STDLIB_NDARRAY_CTOR_IGET_H - -#include "ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Returns an ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget( const struct ndarray *arr, const int64_t idx, void *out ); - -/** -* Returns a double-precision floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_float64( const struct ndarray *arr, const int64_t idx, double *out ); - -/** -* Returns a single-precision floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_float32( const struct ndarray *arr, const int64_t idx, float *out ); - -/** -* Returns an unsigned 64-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_uint64( const struct ndarray *arr, const int64_t idx, uint64_t *out ); - -/** -* Returns a signed 64-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_int64( const struct ndarray *arr, const int64_t idx, int64_t *out ); - -/** -* Returns an unsigned 32-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_uint32( const struct ndarray *arr, const int64_t idx, uint32_t *out ); - -/** -* Returns a signed 32-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_int32( const struct ndarray *arr, const int64_t idx, int32_t *out ); - -/** -* Returns an unsigned 16-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_uint16( const struct ndarray *arr, const int64_t idx, uint16_t *out ); - -/** -* Returns a signed 16-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_int16( const struct ndarray *arr, const int64_t idx, int16_t *out ); - -/** -* Returns an unsigned 8-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_uint8( const struct ndarray *arr, const int64_t idx, uint8_t *out ); - -/** -* Returns a signed 8-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_int8( const struct ndarray *arr, const int64_t idx, int8_t *out ); - -/** -* Returns a double-precision complex floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_complex128( const struct ndarray *arr, const int64_t idx, stdlib_complex128_t *out ); - -/** -* Returns a single-precision complex floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_complex64( const struct ndarray *arr, const int64_t idx, stdlib_complex64_t *out ); - -/** -* Returns a boolean ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iget_bool( const struct ndarray *arr, const int64_t idx, bool *out ); - -#endif // !STDLIB_NDARRAY_CTOR_IGET_H diff --git a/include/stdlib/ndarray/ctor/iget_ptr.h b/include/stdlib/ndarray/ctor/iget_ptr.h deleted file mode 100644 index f09aef2..0000000 --- a/include/stdlib/ndarray/ctor/iget_ptr.h +++ /dev/null @@ -1,30 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_IGET_PTR_H -#define STDLIB_NDARRAY_CTOR_IGET_PTR_H - -#include "ndarray.h" -#include - -/** -* Returns a pointer in the underlying byte array for an ndarray data element located at a specified linear index. -*/ -uint8_t * stdlib_ndarray_iget_ptr( const struct ndarray *arr, const int64_t idx ); - -#endif // !STDLIB_NDARRAY_CTOR_IGET_PTR_H diff --git a/include/stdlib/ndarray/ctor/iset.h b/include/stdlib/ndarray/ctor/iset.h deleted file mode 100644 index 01e3199..0000000 --- a/include/stdlib/ndarray/ctor/iset.h +++ /dev/null @@ -1,98 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_ISET_H -#define STDLIB_NDARRAY_CTOR_ISET_H - -#include "ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Sets an ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset( const struct ndarray *arr, const int64_t idx, const void *v ); - -/** -* Sets a double-precision floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_float64( const struct ndarray *arr, const int64_t idx, const double v ); - -/** -* Sets a single-precision floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_float32( const struct ndarray *arr, const int64_t idx, const float v ); - -/** -* Sets an unsigned 64-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_uint64( const struct ndarray *arr, const int64_t idx, const uint64_t v ); - -/** -* Sets a signed 64-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_int64( const struct ndarray *arr, const int64_t idx, const int64_t v ); - -/** -* Sets an unsigned 32-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_uint32( const struct ndarray *arr, const int64_t idx, const uint32_t v ); - -/** -* Sets a signed 32-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_int32( const struct ndarray *arr, const int64_t idx, const int32_t v ); - -/** -* Sets an unsigned 16-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_uint16( const struct ndarray *arr, const int64_t idx, const uint16_t v ); - -/** -* Sets a signed 16-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_int16( const struct ndarray *arr, const int64_t idx, const int16_t v ); - -/** -* Sets an unsigned 8-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_uint8( const struct ndarray *arr, const int64_t idx, const uint8_t v ); - -/** -* Sets a signed 8-bit integer ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_int8( const struct ndarray *arr, const int64_t idx, const int8_t v ); - -/** -* Sets a double-precision complex floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_complex128( const struct ndarray *arr, const int64_t idx, const stdlib_complex128_t v ); - -/** -* Sets a single-precision complex floating-point ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_complex64( const struct ndarray *arr, const int64_t idx, const stdlib_complex64_t v ); - -/** -* Sets a boolean ndarray data element located at a specified linear index. -*/ -int8_t stdlib_ndarray_iset_bool( const struct ndarray *arr, const int64_t idx, const bool v ); - -#endif // !STDLIB_NDARRAY_CTOR_ISET_H diff --git a/include/stdlib/ndarray/ctor/macros.h b/include/stdlib/ndarray/ctor/macros.h deleted file mode 100644 index 8443b43..0000000 --- a/include/stdlib/ndarray/ctor/macros.h +++ /dev/null @@ -1,46 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_MACROS_H -#define STDLIB_NDARRAY_CTOR_MACROS_H - -/** -* Flag indicating whether an ndarray is row-major (C-style) contiguous. -* -* ## 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). -*/ -#define STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG 0x0000000000000001 - -/** -* Flag indicating whether an ndarray is column-major (Fortran-style) contiguous. -* -* ## 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). -*/ -#define STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG 0x0000000000000002 - -#endif // !STDLIB_NDARRAY_CTOR_MACROS_H diff --git a/include/stdlib/ndarray/ctor/ndarray.h b/include/stdlib/ndarray/ctor/ndarray.h deleted file mode 100644 index 7e8f0bb..0000000 --- a/include/stdlib/ndarray/ctor/ndarray.h +++ /dev/null @@ -1,137 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_NDARRAY_H -#define STDLIB_NDARRAY_CTOR_NDARRAY_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 - -/** -* ndarray structure. -* -* @example -* #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 -* -* struct ndarray *x = malloc( sizeof( struct ndarray ) ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( 1 ); -* } -* -* // 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 }; -* x->data = buffer; -* -* // Specify the underlying data type: -* x->dtype = STDLIB_NDARRAY_FLOAT64; -* -* // Explicitly specify the number of bytes per element: -* x->BYTES_PER_ELEMENT = STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT; -* -* // Specify the array shape: -* int64_t shape[] = { 3 }; // vector consisting of 3 doubles -* x->shape = shape; -* -* // Specify the array strides: -* int64_t strides[] = { x->BYTES_PER_ELEMENT }; -* x->strides = strides; -* -* // Specify the byte offset: -* x->offset = 0; -* -* // Specify the array order (note: this does not matter for a 1-dimensional array): -* x->order = STDLIB_NDARRAY_ROW_MAJOR; -* -* // Specify the index mode: -* x->imode = STDLIB_NDARRAY_INDEX_ERROR; -* -* // Specify subscript index modes: -* x->submodes = { STDLIB_NDARRAY_INDEX_ERROR }; -* x->nsubmodes = 1; -* -* // Explicitly specify the number of array dimensions: -* x->ndims = 1; // vector -* -* // Explicitly specify the number of array elements (doubles): -* x->length = x->shape[ 0 ]; -* -* // Explicitly specify the number of bytes: -* x->byteLength = (x->length) * (x->BYTES_PER_ELEMENT); -* -* // Explicitly set the array flags: -* x->flags = stdlib_ndarray_flags( x ); -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -*/ -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; -}; - -#endif // !STDLIB_NDARRAY_CTOR_NDARRAY_H diff --git a/include/stdlib/ndarray/ctor/set.h b/include/stdlib/ndarray/ctor/set.h deleted file mode 100644 index c9130d2..0000000 --- a/include/stdlib/ndarray/ctor/set.h +++ /dev/null @@ -1,98 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_SET_H -#define STDLIB_NDARRAY_CTOR_SET_H - -#include "ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Sets an ndarray data element. -*/ -int8_t stdlib_ndarray_set( const struct ndarray *arr, const int64_t *sub, const void *v ); - -/** -* Sets a double-precision floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_set_float64( const struct ndarray *arr, const int64_t *sub, const double v ); - -/** -* Sets a single-precision floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_set_float32( const struct ndarray *arr, const int64_t *sub, const float v ); - -/** -* Sets an unsigned 64-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_uint64( const struct ndarray *arr, const int64_t *sub, const uint64_t v ); - -/** -* Sets a signed 64-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_int64( const struct ndarray *arr, const int64_t *sub, const int64_t v ); - -/** -* Sets an unsigned 32-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_uint32( const struct ndarray *arr, const int64_t *sub, const uint32_t v ); - -/** -* Sets a signed 32-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_int32( const struct ndarray *arr, const int64_t *sub, const int32_t v ); - -/** -* Sets an unsigned 16-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_uint16( const struct ndarray *arr, const int64_t *sub, const uint16_t v ); - -/** -* Sets a signed 16-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_int16( const struct ndarray *arr, const int64_t *sub, const int16_t v ); - -/** -* Sets an unsigned 8-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_uint8( const struct ndarray *arr, const int64_t *sub, const uint8_t v ); - -/** -* Sets a signed 8-bit integer ndarray data element. -*/ -int8_t stdlib_ndarray_set_int8( const struct ndarray *arr, const int64_t *sub, const int8_t v ); - -/** -* Sets a double-precision complex floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_set_complex128( const struct ndarray *arr, const int64_t *sub, const stdlib_complex128_t v ); - -/** -* Sets a single-precision complex floating-point ndarray data element. -*/ -int8_t stdlib_ndarray_set_complex64( const struct ndarray *arr, const int64_t *sub, const stdlib_complex64_t v ); - -/** -* Sets a boolean ndarray data element. -*/ -int8_t stdlib_ndarray_set_bool( const struct ndarray *arr, const int64_t *sub, const bool v ); - -#endif // !STDLIB_NDARRAY_CTOR_SET_H diff --git a/include/stdlib/ndarray/ctor/set_ptr.h b/include/stdlib/ndarray/ctor/set_ptr.h deleted file mode 100644 index acefb98..0000000 --- a/include/stdlib/ndarray/ctor/set_ptr.h +++ /dev/null @@ -1,98 +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. -*/ - -#ifndef STDLIB_NDARRAY_CTOR_SET_PTR_H -#define STDLIB_NDARRAY_CTOR_SET_PTR_H - -#include "ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Sets an ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_value( const struct ndarray *arr, uint8_t *idx, const void *v ); - -/** -* Sets a double-precision floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_float64( uint8_t *idx, const double v ); - -/** -* Sets a single-precision floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_float32( uint8_t *idx, const float v ); - -/** -* Sets an unsigned 64-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_uint64( uint8_t *idx, const uint64_t v ); - -/** -* Sets a signed 64-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_int64( uint8_t *idx, const int64_t v ); - -/** -* Sets an unsigned 32-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_uint32( uint8_t *idx, const uint32_t v ); - -/** -* Sets a signed 32-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_int32( uint8_t *idx, const int32_t v ); - -/** -* Sets an unsigned 16-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_uint16( uint8_t *idx, const uint16_t v ); - -/** -* Sets a signed 16-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_int16( uint8_t *idx, const int16_t v ); - -/** -* Sets an unsigned 8-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_uint8( uint8_t *idx, const uint8_t v ); - -/** -* Sets a signed 8-bit integer ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_int8( uint8_t *idx, const int8_t v ); - -/** -* Sets a double-precision complex floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_complex128( uint8_t *idx, const stdlib_complex128_t v ); - -/** -* Sets a single-precision complex floating-point ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_complex64( uint8_t *idx, const stdlib_complex64_t v ); - -/** -* Sets a boolean ndarray data element specified by a byte array pointer. -*/ -int8_t stdlib_ndarray_set_ptr_bool( uint8_t *idx, const bool v ); - -#endif // !STDLIB_NDARRAY_CTOR_SET_PTR_H diff --git a/index.js b/index.js new file mode 100644 index 0000000..89aa72f --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).ndarray=r()}(this,(function(){"use strict";var t="function"==typeof Object.defineProperty?Object.defineProperty:null;var r=Object.defineProperty;function e(t){return"number"==typeof t}function n(t){var r,e="";for(r=0;r0&&(r-=1),n=i.toExponential(r)):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 b(t){var r,e="";for(r=0;r127)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":r||(n.precision=6),n.arg=v(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+b(y):b(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 r={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]&&(r.precision="1"),r}function O(t){var r,e,n,i;for(e=[],i=0,n=j.exec(t);n;)(r=t.slice(i,j.lastIndex-n[0].length)).length&&e.push(r),e.push(V(n)),i=j.lastIndex,n=j.exec(t);return(r=t.slice(i)).length&&e.push(r),e}function S(t){var r,e;if("string"!=typeof t)throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));for(r=[O(t)],e=1;e=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;var z=Object.prototype.hasOwnProperty;function X(t,r){return null!=t&&z.call(t,r)}var Z="function"==typeof Symbol?Symbol:void 0,H="function"==typeof Z?Z.toStringTag:"";var Q=J()?function(t){var r,e,n;if(null==t)return $.call(t);e=t[H],r=X(t,H);try{t[H]=void 0}catch(r){return $.call(t)}return n=$.call(t),r?t[H]=e:delete t[H],n}:function(t){return $.call(t)},q=Number,K=q.prototype.toString;var tt=J();function rt(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 et(t){return W(t)||rt(t)}C(et,"isPrimitive",W),C(et,"isObject",rt);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 rt(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(r){var e,n;if(!function(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&P(t.length)&&t.length>=0&&t.length<=ct}(r))return!1;if(e=r.length,0===e)return!1;for(n=0;n=0&&t.length<=ct}var qr="function"==typeof ArrayBuffer;function Kr(t){return qr&&t instanceof ArrayBuffer||"[object ArrayBuffer]"===Q(t)}function te(t){return"object"==typeof t&&null!==t&&!Nt(t)}function re(t){return"string"==typeof t}var ee=String.prototype.valueOf;var ne=J();function ie(t){return"object"==typeof t&&(t instanceof String||(ne?function(t){try{return ee.call(t),!0}catch(t){return!1}}(t):"[object String]"===Q(t)))}function oe(t){return re(t)||ie(t)}function ae(t,r){if(!(this instanceof ae))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(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}C(oe,"isPrimitive",re),C(oe,"isObject",ie),C(ae,"BYTES_PER_ELEMENT",8),C(ae.prototype,"BYTES_PER_ELEMENT",8),C(ae.prototype,"byteLength",16),C(ae.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(ae.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var ue="function"==typeof Math.fround?Math.fround:null,fe=new mr(1);var se="function"==typeof ue?ue:function(t){return fe[0]=t,fe[0]};function le(t,r){if(!(this instanceof le))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(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:se(t)}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:se(r)}),this}function he(t){return t instanceof ae||t instanceof le||"object"==typeof t&&null!==t&&"number"==typeof t.re&&"number"==typeof t.im}function ce(t){return P(t/2)}C(le,"BYTES_PER_ELEMENT",4),C(le.prototype,"BYTES_PER_ELEMENT",4),C(le.prototype,"byteLength",8),C(le.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(le.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var pe=8;function me(t){return"object"==typeof t&&null!==t&&"Complex64Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===pe}var ye=16;function ge(t){return"object"==typeof t&&null!==t&&"Complex128Array"===t.constructor.name&&t.BYTES_PER_ELEMENT===ye}function we(){return"function"==typeof Z&&"symbol"==typeof Z("foo")&&X(Z,"iterator")&&"symbol"==typeof Z.iterator}var de=we()?Symbol.iterator:null;function ve(t,r,e){N(t,r,{configurable:!1,enumerable:!1,get:e})}function be(t,r){if(!(this instanceof be))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(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:se(t)}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:se(r)}),this}function _e(t){return t.re}function Ee(t){return t.im}function Te(t,r){return new mr(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function xe(t,r){return new sr(t.buffer,t.byteOffset+t.BYTES_PER_ELEMENT*r,2*(t.length-r))}function Ae(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(Qr(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!he(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));r.push(_e(n),Ee(n))}return r}C(be,"BYTES_PER_ELEMENT",4),C(be.prototype,"BYTES_PER_ELEMENT",4),C(be.prototype,"byteLength",8),C(be.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(be.prototype,"toJSON",(function(){var t={type:"Complex64"};return t.re=this.re,t.im=this.im,t}));var je=2*mr.BYTES_PER_ELEMENT,Ve=we();function Oe(t){return t instanceof Re||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Se(t){return t===Re||"Complex128Array"===t.name}function Ie(t,r){return new be(t[r*=2],t[r+1])}function Re(){var t,r,e,n;if(r=arguments.length,!(this instanceof Re))return 0===r?new Re:1===r?new Re(arguments[0]):2===r?new Re(arguments[0],arguments[1]):new Re(arguments[0],arguments[1],arguments[2]);if(0===r)e=new mr(0);else if(1===r)if(st(arguments[0]))e=new mr(2*arguments[0]);else if(D(arguments[0]))if((n=(e=arguments[0]).length)&&Nt(e)&&he(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;ie.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*je));e=new mr(e,t,2*n)}}return C(this,"_buffer",e),C(this,"_length",e.length/2),this}function Le(t,r){if(!(this instanceof Le))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(r))throw new TypeError(S("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return N(this,"re",{configurable:!1,enumerable:!0,writable:!1,value:t}),N(this,"im",{configurable:!1,enumerable:!0,writable:!1,value:r}),this}function Fe(t){return t.re}function Ue(t){return t.im}function Be(t){var r,e,n;for(r=[];!(e=t.next()).done;)if(Qr(n=e.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!he(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));r.push(Fe(n),Ue(n))}return r}C(Re,"BYTES_PER_ELEMENT",je),C(Re,"name","Complex64Array"),C(Re,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Se(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Wt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Oe(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?rr("default"):nr("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(te(t)&&Ve&&Wt(t[de])){if(!Wt((o=t[de]()).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,r,e){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,Qr(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!he(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(_e(o),Ee(o))}return n}(o,n,r):Ae(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Ie(this._buffer,t)})),ve(Re.prototype,"buffer",(function(){return this._buffer.buffer})),ve(Re.prototype,"byteLength",(function(){return this._buffer.byteLength})),ve(Re.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(Re.prototype,"BYTES_PER_ELEMENT",Re.BYTES_PER_ELEMENT),C(Re.prototype,"copyWithin",(function(t,r){if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*r):this._buffer.copyWithin(2*t,2*r,2*arguments[2]),this})),C(Re.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,t=this._buffer,n=this._length,o=-1,a=-2,C(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new be(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),C(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),de&&C(e,de,(function(){return r.entries()})),e})),C(Re.prototype,"every",(function(t,r){var e,n;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!P(e))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",e));e<0&&(e+=i)<0&&(e=0),e>i&&(e=i)}else e=i}else r=0,e=i;for(a=_e(t),u=Ee(t),f=r;f=0;n--)if(i=Ie(e,n),t.call(r,i,n,this))return i})),C(Re.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=Ie(e,n),t.call(r,i,n,this))return n;return-1})),C(Re.prototype,"forEach",(function(t,r){var e,n,i;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return Ie(this._buffer,t)})),C(Re.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!he(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=_e(t),o=Ee(t),e=this._buffer,a=r;a1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=_e(t),o=Ee(t),e=this._buffer,a=r;a1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=_e(t),o=Ee(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),ve(Re.prototype,"length",(function(){return this._length})),C(Re.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,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=Ie(e,0),o=1}for(;o1){if(!st(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(he(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=_e(t),void(n[e+1]=Ee(t))}if(Oe(t)){if(e+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t._buffer,s=n.byteOffset+e*je,r.buffer===n.buffer&&r.byteOffsets){for(i=new mr(r.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*je,r.buffer===n.buffer&&r.byteOffsets){for(i=new mr(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;fu&&(r=u)}}for(e=ti&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*je):(i=r-t,e=n.byteOffset+t*je),new this.constructor(n.buffer,e,i<0?0:i)})),C(Re.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Oe(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,r=new this.constructor(e),n=this._buffer,t=r._buffer,i=0;i=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!he(r))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=_e(r),e[2*t+1]=Ee(r),n})),C(Le,"BYTES_PER_ELEMENT",8),C(Le.prototype,"BYTES_PER_ELEMENT",8),C(Le.prototype,"byteLength",16),C(Le.prototype,"toString",(function(){var t=""+this.re;return this.im<0?t+=" - "+-this.im:t+=" + "+this.im,t+="i"})),C(Le.prototype,"toJSON",(function(){var t={type:"Complex128"};return t.re=this.re,t.im=this.im,t}));var ke=2*sr.BYTES_PER_ELEMENT,Ne=we();function Ce(t){return t instanceof Ye||"object"==typeof t&&null!==t&&("Complex64Array"===t.constructor.name||"Complex128Array"===t.constructor.name)&&"number"==typeof t._length&&"object"==typeof t._buffer}function Me(t){return t===Ye||"Complex64Array"===t.name}function Pe(t,r){return new Le(t[r*=2],t[r+1])}function Ye(){var t,r,e,n;if(r=arguments.length,!(this instanceof Ye))return 0===r?new Ye:1===r?new Ye(arguments[0]):2===r?new Ye(arguments[0],arguments[1]):new Ye(arguments[0],arguments[1],arguments[2]);if(0===r)e=new sr(0);else if(1===r)if(st(arguments[0]))e=new sr(2*arguments[0]);else if(D(arguments[0]))if((n=(e=arguments[0]).length)&&Nt(e)&&he(e[0])){if(e=function(t,r){var e,n,i,o;for(e=r.length,o=0,i=0;ie.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*ke));e=new sr(e,t,2*n)}}return C(this,"_buffer",e),C(this,"_length",e.length/2),this}C(Ye,"BYTES_PER_ELEMENT",ke),C(Ye,"name","Complex128Array"),C(Ye,"from",(function(t){var r,e,n,i,o,a,u,f,s,l,h,c;if(!Wt(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Me(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((e=arguments.length)>1){if(!Wt(n=arguments[1]))throw new TypeError(S("invalid argument. Second argument must be a function. Value: `%s`.",n));e>2&&(r=arguments[2])}if(Ce(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?rr("default"):nr("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(te(t)&&Ne&&Wt(t[de])){if(!Wt((o=t[de]()).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,r,e){var n,i,o,a;for(n=[],a=-1;!(i=t.next()).done;)if(a+=1,Qr(o=r.call(e,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!he(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(Fe(o),Ue(o))}return n}(o,n,r):Be(o),a instanceof Error)throw a;for(o=(i=new this(f=a.length/2))._buffer,h=0;h=this._length))return Pe(this._buffer,t)})),ve(Ye.prototype,"buffer",(function(){return this._buffer.buffer})),ve(Ye.prototype,"byteLength",(function(){return this._buffer.byteLength})),ve(Ye.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),C(Ye.prototype,"BYTES_PER_ELEMENT",Ye.BYTES_PER_ELEMENT),C(Ye.prototype,"copyWithin",(function(t,r){if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*t,2*r):this._buffer.copyWithin(2*t,2*r,2*arguments[2]),this})),C(Ye.prototype,"entries",(function(){var t,r,e,n,i,o,a;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,t=this._buffer,n=this._length,o=-1,a=-2,C(e={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Le(t[a+=2],t[a+1]),{value:[o,r],done:!1}})),C(e,"return",(function(t){if(i=!0,arguments.length)return{value:t,done:!0};return{done:!0}})),de&&C(e,de,(function(){return r.entries()})),e})),C(Ye.prototype,"every",(function(t,r){var e,n;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!P(e))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",e));e<0&&(e+=i)<0&&(e=0),e>i&&(e=i)}else e=i}else r=0,e=i;for(a=Fe(t),u=Ue(t),f=r;f=0;n--)if(i=Pe(e,n),t.call(r,i,n,this))return i})),C(Ye.prototype,"findLastIndex",(function(t,r){var e,n,i;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=this._length-1;n>=0;n--)if(i=Pe(e,n),t.call(r,i,n,this))return n;return-1})),C(Ye.prototype,"forEach",(function(t,r){var e,n,i;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(e=this._buffer,n=0;n=this._length))return Pe(this._buffer,t)})),ve(Ye.prototype,"length",(function(){return this._length})),C(Ye.prototype,"includes",(function(t,r){var e,n,i,o,a;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!he(t))throw new TypeError(S("invalid argument. First argument must be a complex number. Value: `%s`.",t));if(arguments.length>1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Fe(t),o=Ue(t),e=this._buffer,a=r;a1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=Fe(t),o=Ue(t),e=this._buffer,a=r;a1){if(!P(r))throw new TypeError(S("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=Fe(t),o=Ue(t),e=this._buffer,a=r;a>=0;a--)if(i===e[n=2*a]&&o===e[n+1])return a;return-1})),C(Ye.prototype,"map",(function(t,r){var e,n,i,o,a;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Wt(t))throw new TypeError(S("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,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=Pe(e,0),o=1}for(;o1){if(!st(e=arguments[1]))throw new TypeError(S("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",e))}else e=0;if(he(t)){if(e>=this._length)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%u`.",e));return n[e*=2]=Fe(t),void(n[e+1]=Ue(t))}if(Ce(t)){if(e+(a=t._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t._buffer,s=n.byteOffset+e*ke,r.buffer===n.buffer&&r.byteOffsets){for(i=new sr(r.length),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,s=n.byteOffset+e*ke,r.buffer===n.buffer&&r.byteOffsets){for(i=new sr(a),f=0;fthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(e*=2,f=0;fu&&(r=u)}}for(e=ti&&(r=i)}}return t>=i?(i=0,e=n.byteLength):t>=r?(i=0,e=n.byteOffset+t*ke):(i=r-t,e=n.byteOffset+t*ke),new this.constructor(n.buffer,e,i<0?0:i)})),C(Ye.prototype,"toReversed",(function(){var t,r,e,n,i,o;if(!Ce(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(e=this._length,r=new this.constructor(e),n=this._buffer,t=r._buffer,i=0;i=i)throw new RangeError(S("invalid argument. Index argument is out-of-bounds. Value: `%s`.",t));if(!he(r))throw new TypeError(S("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(e=(n=new this.constructor(this._buffer))._buffer)[2*t]=Fe(r),e[2*t+1]=Ue(r),n}));var De=[sr,mr,Ar,br,Br,Ir,Hr,Pr,Jr,Re,Ye],We=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128"],Ge=We.length;function Je(t){var r;if(Nt(t))return"generic";if(Pt(t))return null;for(r=0;r0&&r.push("generic"),r)}function Qe(){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 qe(t,r,e){N(t,r,{configurable:!1,enumerable:!0,writable:!1,value:e})}function Ke(t){return Object.keys(Object(t))}var tn,rn=void 0!==Object.keys;function en(t){return"[object Arguments]"===Q(t)}tn=function(){return en(arguments)}();var nn=tn;function on(t){return t!=t}function an(t){return W(t)&&on(t)}function un(t){return rt(t)&&on(t.valueOf())}function fn(t){return an(t)||un(t)}C(fn,"isPrimitive",an),C(fn,"isObject",un);var sn=Object.prototype.propertyIsEnumerable;var ln=!sn.call("beep","0");function hn(t,r){var e;return null!=t&&(!(e=sn.call(t,r))&&ln&&oe(t)?!an(r=+r)&&at(r)&&r>=0&&r=0&&t.length<=gr&&X(t,"callee")&&!hn(t,"callee")},pn=Array.prototype.slice;var mn=hn((function(){}),"prototype"),yn=!hn({toString:null},"toString");function gn(t,r,e){var n,i;if(!D(t)&&!re(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(e))throw new TypeError(S("invalid argument. Third argument must be an integer. Value: `%s`.",e));if(e>=0){if(e>=n)return-1;i=e}else(i=n+e)<0&&(i=0)}else i=0;if(fn(r)){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(jn,"assign",(function(t,r,e,n){var i,o,a,u,f;for(i=t.length,o=e,a=e,f=0;f0?a+=u*(t[f]-1):u<0&&(o+=u*(t[f]-1))}return n[0]=o,n[1]=a,n}));var Vn=Rt();var On={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 Sn(t){return Math.abs(t)}function In(t,r){return r&&(2===t||3===t)}function Rn(t,r){return r&&(1===t||3===t)}function Ln(t){return t.re}function Fn(t){return t.im}var Un=/[-\/\\^$*+?.()|[\]{}]/g;var Bn=RegExp.prototype.exec;var kn=J();function Nn(t){return"object"==typeof t&&(t instanceof RegExp||(kn?function(t){try{return Bn.call(t),!0}catch(t){return!1}}(t):"[object RegExp]"===Q(t)))}function Cn(t,r,e){if(!re(t))throw new TypeError(S("invalid argument. First argument must be a string. Value: `%s`.",t));if(re(r))r=new RegExp(function(t){var r,e;if(!re(t))throw new TypeError(S("invalid argument. Must provide a regular expression string. Value: `%s`.",t));if("/"===t[0])for(e=t.length-1;e>=0&&"/"!==t[e];e--);return void 0===e||e<=0?t.replace(Un,"\\$&"):(r=(r=t.substring(1,e)).replace(Un,"\\$&"),t=t[0]+r+t.substring(e))}(r),"g");else if(!Nn(r))throw new TypeError(S("invalid argument. Second argument must be a string or regular expression. Value: `%s`.",r));if(!re(e)&&!Wt(e))throw new TypeError(S("invalid argument. Third argument must be a string or replacement function. Value: `%s`.",e));return ze(t,r,e)}var 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}} ] )"};var Pn,Yn={uint16:Ir,uint8:Pr};(Pn=new Yn.uint16(1))[0]=4660;var Dn=52===new Yn.uint8(Pn.buffer)[0],Wn="function"==typeof ArrayBuffer?ArrayBuffer:null;var Gn,Jn="function"==typeof ArrayBuffer?ArrayBuffer:void 0;Gn=function(){var t,r,e;if("function"!=typeof Wn)return!1;try{(t=Kr(e=new Wn(16))&&"function"==typeof Wn.isView)&&((r=new sr(e))[0]=-3.14,r[1]=NaN,t=t&&Wn.isView(r)&&16===e.byteLength&&-3.14===r[0]&&r[1]!=r[1])}catch(r){t=!1}return t}()?Jn:function(){throw new Error("not implemented")};var $n=Gn,zn="function"==typeof DataView;var Xn="function"==typeof DataView?DataView:null;var Zn,Hn="function"==typeof DataView?DataView:void 0;Zn=function(){var t,r,e,n;if("function"!=typeof Xn)return!1;try{e=new $n(24),r=new Xn(e,8),n=r,(t=(zn&&n instanceof DataView||"[object DataView]"===Q(n))&&"function"==typeof r.getFloat64&&"function"==typeof r.setFloat64)&&(r.setFloat64(0,-3.14),r.setFloat64(8,NaN),t=t&&r.buffer===e&&16===r.byteLength&&8===r.byteOffset&&-3.14===r.getFloat64(0)&&r.getFloat64(8)!=r.getFloat64(8))}catch(r){t=!1}return t}()?Hn:function(){throw new Error("not implemented")};var Qn=Zn,qn="function"==typeof BigInt?BigInt:void 0,Kn=["throw","normalize","clamp","wrap"];function ti(){return Kn.slice()}function ri(){return{throw:1,clamp:2,wrap:3,normalize:4}}C(ti,"enum",ri);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},ni=Zt(),ii={throw:1,clamp:2,wrap:3,normalize:4};var oi=4294967295,ai=4294967296,ui=new Pr(8),fi=new Qn(ui.buffer);function si(t,r,e,n){var i,o,a;if(0===t){for(a=0;a>>0,i=M(t/ai),Dn?(fi.setUint32(0,o,Dn),fi.setUint32(4,i,Dn)):(fi.setUint32(0,i,Dn),fi.setUint32(4,o,Dn)),a=0;a>>0,n=M(t/4294967296),e=new Qn(r.buffer),Dn?(e.setUint32(0,i,Dn),e.setUint32(4,n,Dn)):(e.setUint32(0,n,Dn),e.setUint32(4,i,Dn))),r}),"assign",si);var li={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},hi=Zt(),ci={throw:1,clamp:2,wrap:3,normalize:4};function pi(t,r,e,n,i,o){var a,u,f,s,l;if(!(this instanceof pi))return new pi(t,r,e,n,i,o);for(s=1,l=0;li&&(n=!1),!n&&!r)return 0;i=o}return n&&r?3:n?1:2}(n),this._flags={ROW_MAJOR_CONTIGUOUS:Rn(f,a),COLUMN_MAJOR_CONTIGUOUS:In(f,a),READONLY:!1},this.__meta_dataview__=null,this}function mi(){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(pi,"name","ndarray"),ve(pi.prototype,"byteLength",(function(){return this._byteLength})),ve(pi.prototype,"BYTES_PER_ELEMENT",(function(){return this._bytesPerElement})),ve(pi.prototype,"data",(function(){return this._buffer})),ve(pi.prototype,"dtype",(function(){return this._dtype})),ve(pi.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})),ve(pi.prototype,"length",(function(){return this._length})),ve(pi.prototype,"ndims",(function(){return this._ndims})),ve(pi.prototype,"offset",(function(){return this._offset})),ve(pi.prototype,"order",(function(){return this._order})),ve(pi.prototype,"shape",(function(){return this._shape.slice()})),ve(pi.prototype,"strides",(function(){return this._strides.slice()})),C(pi.prototype,"get",(function(){var t,r;for(t=this._offset,r=0;r=0;a--)t-=o=t%e[a],t/=e[a],i+=o*r[a];return this._accessors?this._buffer.get(i):this._buffer[i]})),C(pi.prototype,"set",(function(){var t,r;for(t=this._offset,r=0;r=0;u--)t-=a=t%n[u],t/=n[u],o+=a*e[u];return this._accessors?this._buffer.set(r,o):this._buffer[o]=r,this})),C(pi.prototype,"toString",(function(){var t,r,e,n,i,o;if(r=this._shape.length,e="ndarray( '"+(n=this._dtype)+"', ",t="",this._length<=100)if("complex64"===n||"complex128"===n)for(o=0;o=0;o--)t+=Ln(i=this.iget(this._length-1-o))+", "+Fn(i),o>0&&(t+=", ");else for(o=2;o>=0;o--)t+=this.iget(this._length-1-o),o>0&&(t+=", ")}if(e+=Cn(Mn[this.dtype],"{{data}}",t),e+=", ",e+=0===r?"[]":"[ "+this._shape.join(", ")+" ]",e+=", ",e+="[ ",0===r)e+="0";else for(o=0;or?r:t}function Ti(t,r){var e=r+1;return t<0?((t+=e)<0&&0!==(t%=e)&&(t+=e),t):t>r?((t-=e)>r&&(t%=e),t):t}function xi(t,r){return t<0?(t+=r+1)<0?-1:t:t>r?-1:t}var Ai=$e(ti()),ji={wrap:Ti,clamp:Ei,normalize:function(t,r){var e=xi(t,r);if(e<0||e>r)throw new RangeError(S("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",r,t));return e},throw:function(t,r){if(t<0||t>r)throw new RangeError(S("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",r,t));return t}};function Vi(t,r,e){var n;if("clamp"===e)return Ei(t,r);if("wrap"===e)return Ti(t,r);if(n=t,"normalize"===e&&(n=xi(n,r)),n<0||n>r)throw new RangeError(S("invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.",r,t));return n}C(Vi,"factory",(function(t){if(!Ai(t))throw new TypeError(S("invalid argument. First argument must be a recognized index mode. Value: `%s`.",t));return ji[t]}));var Oi=pi.prototype.iget;var Si=pi.prototype.iset;function Ii(t,r){var e,n;for(e=[],n=0;n0))throw new TypeError(_i("0jp5S",e));if((u=e.length)>32767)throw new RangeError(_i("0jp5T",32767,u));if(!wt(n))throw new TypeError(_i("0jp5U",n));if(u>0){if(n.length!==u)throw new RangeError(_i("0jp5V",u,n.length))}else{if(1!==n.length)throw new RangeError(_i("0jp0f"));if(0!==n[0])throw new RangeError(_i("0jpDt",n[0]))}if(!st(i))throw new TypeError(_i("0jp5X",i));if(!function(t){var r;for(r=0;r0&&!function(t,r,e,n){var i=jn(r,e,n);return i[0]>=0&&i[1]0)throw new Error(_i("0jpCz"));if((f={}).mode=Ni,f.readonly=false,arguments.length>6&&(s=function(t,r){var e;if(!ki(r))return new TypeError(_i("0jp2V",r));if(X(r,"mode")&&(t.mode=r.mode,!Ai(t.mode)))return new TypeError(_i("0jp5a","mode",t.mode));if(X(r,"submode")){if(t.submode=r.submode,!Qr(t.submode))return new TypeError(_i("0jp5b","submode",t.submode));if(0===t.submode.length)return new TypeError(_i("0jp5b","submode",t.submode.join(",")));for(e=0;e0){if(!at(t))throw new TypeError(_i("0jp5O",t));return t=Vi(t,this._length-1,this._mode),Oi.call(this,t)}return Oi.call(this)})),C(Ci.prototype,"set",(function(){var t,r,e,n;if(this._flags.READONLY)throw new Error(_i("0jp0e"));if(arguments.length!==this._ndims+1)throw new RangeError(_i("0jp5M",this._ndims,arguments.length));for(t=this._offset,e=this._submode.length,n=0;n0){if(!at(t))throw new TypeError(_i("0jp5O",t));t=Vi(t,this._length-1,this._mode),Si.call(this,t,r)}else Si.call(this,t);return this})),Ci})); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..60ff9b5 --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.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.js","../node_modules/@stdlib/utils-global/lib/global_this.js","../node_modules/@stdlib/utils-global/lib/main.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/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/array-float64/lib/index.js","../node_modules/@stdlib/assert-has-float64array-support/lib/main.js","../node_modules/@stdlib/array-float64/lib/polyfill.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/array-float32/lib/index.js","../node_modules/@stdlib/assert-has-float32array-support/lib/main.js","../node_modules/@stdlib/array-float32/lib/polyfill.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/array-uint32/lib/index.js","../node_modules/@stdlib/assert-has-uint32array-support/lib/main.js","../node_modules/@stdlib/array-uint32/lib/polyfill.js","../node_modules/@stdlib/assert-is-int32array/lib/main.js","../node_modules/@stdlib/constants-int32-max/lib/index.js","../node_modules/@stdlib/assert-has-int32array-support/lib/int32array.js","../node_modules/@stdlib/array-int32/lib/main.js","../node_modules/@stdlib/array-int32/lib/index.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/assert-is-uint16array/lib/main.js","../node_modules/@stdlib/constants-uint16-max/lib/index.js","../node_modules/@stdlib/assert-has-uint16array-support/lib/uint16array.js","../node_modules/@stdlib/array-uint16/lib/main.js","../node_modules/@stdlib/array-uint16/lib/index.js","../node_modules/@stdlib/assert-has-uint16array-support/lib/main.js","../node_modules/@stdlib/array-uint16/lib/polyfill.js","../node_modules/@stdlib/assert-is-int16array/lib/main.js","../node_modules/@stdlib/constants-int16-max/lib/index.js","../node_modules/@stdlib/assert-has-int16array-support/lib/int16array.js","../node_modules/@stdlib/array-int16/lib/main.js","../node_modules/@stdlib/array-int16/lib/index.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/assert-is-uint8array/lib/main.js","../node_modules/@stdlib/constants-uint8-max/lib/index.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/uint8array.js","../node_modules/@stdlib/array-uint8/lib/main.js","../node_modules/@stdlib/array-uint8/lib/index.js","../node_modules/@stdlib/assert-has-uint8array-support/lib/main.js","../node_modules/@stdlib/array-uint8/lib/polyfill.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/array-uint8c/lib/index.js","../node_modules/@stdlib/assert-has-uint8clampedarray-support/lib/main.js","../node_modules/@stdlib/array-uint8c/lib/polyfill.js","../node_modules/@stdlib/assert-is-int8array/lib/main.js","../node_modules/@stdlib/constants-int8-max/lib/index.js","../node_modules/@stdlib/assert-has-int8array-support/lib/int8array.js","../node_modules/@stdlib/array-int8/lib/main.js","../node_modules/@stdlib/array-int8/lib/index.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/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/main.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/ctors.js","../node_modules/@stdlib/assert-is-little-endian/lib/main.js","../node_modules/@stdlib/assert-has-arraybuffer-support/lib/arraybuffer.js","../node_modules/@stdlib/array-buffer/lib/main.js","../node_modules/@stdlib/array-buffer/lib/index.js","../node_modules/@stdlib/assert-has-arraybuffer-support/lib/main.js","../node_modules/@stdlib/array-buffer/lib/polyfill.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/array-dataview/lib/index.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) 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 global === 'object' ) ? global : 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) 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 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 Global from './global.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* @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: Node.js\n\tif ( Global ) {\n\t\treturn Global;\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 \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `layouts.h` enumeration!!!!\n\treturn {\n\t\t// Row-major (C-style):\n\t\t'row-major': 101,\n\n\t\t// Column-major (Fortran-style):\n\t\t'column-major': 102\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumerated;\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/**\n* Return a list of BLAS memory layouts.\n*\n* @module @stdlib/blas-base-layouts\n*\n* @example\n* import layouts from '@stdlib/blas-base-layouts';\n*\n* var list = layouts();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport enumeration from './enum.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\n\n\n// EXPORTS //\n\nexport default main;\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// MODULES //\n\nimport DATA from './data.json';\n\n\n// MAIN //\n\n/**\n* Returns a list of BLAS memory layouts.\n*\n* @returns {StringArray} list of memory layouts\n*\n* @example\n* var list = layouts();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\nfunction layouts() {\n\treturn DATA.slice();\n}\n\n\n// EXPORTS //\n\nexport default layouts;\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 { enum as layouts } from '@stdlib/blas-base-layouts';\n\n\n// VARIABLES //\n\nvar LAYOUTS = layouts();\n\n\n// MAIN //\n\n/**\n* Returns an object mapping supported orders 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 == 1`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects.\n*\n* @returns {Object} object mapping supported orders to integer values\n*\n* @example\n* var table = enumerated();\n* // returns \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `orders.h` enumeration!!!!\n\treturn {\n\t\t// Row-major (C-style):\n\t\t'row-major': LAYOUTS[ 'row-major' ],\n\n\t\t// Column-major (Fortran-style):\n\t\t'column-major': LAYOUTS[ 'column-major' ]\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumerated;\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 list of ndarray orders.\n*\n* @module @stdlib/ndarray-orders\n*\n* @example\n* import orders from '@stdlib/ndarray-orders';\n*\n* var list = orders();\n* // e.g., returns [ 'row-major', 'column-major' ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport enumeration from './enum.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\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 orders from '@stdlib/ndarray-orders';\n\n\n// VARIABLES //\n\nvar ORDERS = orders();\nvar len = ORDERS.length;\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is an ndarray order.\n*\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is an ndarray order\n*\n* @example\n* var bool = isOrder( 'row-major' );\n* // returns true\n*\n* bool = isOrder( 'column-major' );\n* // returns true\n*\n* bool = isOrder( 'foo' );\n* // returns false\n*/\nfunction isOrder( v ) {\n\tvar i;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( v === ORDERS[ i ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isOrder;\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 TYPE = 'function';\n\n\n// MAIN //\n\n/**\n* Tests if an array-like object supports the accessor (get/set) protocol.\n*\n* @param {Object} value - value to test\n* @returns {boolean} boolean indicating whether a value is an accessor array\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var bool = isAccessorArray( new Complex128Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isAccessorArray( [] );\n* // returns false\n*/\nfunction isAccessorArray( value ) {\n\treturn ( typeof value.get === TYPE && typeof value.set === TYPE ); // eslint-disable-line valid-typeof\n}\n\n\n// EXPORTS //\n\nexport default isAccessorArray;\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 GETTERS = {\n\t'complex128': getComplex128,\n\t'complex64': getComplex64,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n* import real from '@stdlib/complex-float64-real';\n* import imag from '@stdlib/complex-float64-imag';\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex128( arr, 1 );\n* // returns \n*\n* var re = real( v );\n* // returns 3.0\n*\n* var im = imag( v );\n* // returns 4.0\n*/\nfunction getComplex128( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getComplex64( arr, 1 );\n* // returns \n*\n* var re = realf( v );\n* // returns 3.0\n*\n* var im = imagf( v );\n* // returns 4.0\n*/\nfunction getComplex64( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n/**\n* Returns an element from an array-like object supporting the get/set protocol.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* function get( idx ) {\n* return arr[ idx ];\n* }\n*\n* function set( value, idx ) {\n* arr[ idx ] = value;\n* }\n*\n* arr.get = get;\n* arr.set = set;\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr.get( idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an array-like object supporting the get/set protocol.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 1 );\n* // returns \n*\n* var re = realf( v );\n* // returns 3.0\n*\n* var im = imagf( v );\n* // returns 4.0\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\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 GETTERS = {\n\t'float64': getFloat64,\n\t'float32': getFloat32,\n\t'int32': getInt32,\n\t'int16': getInt16,\n\t'int8': getInt8,\n\t'uint32': getUint32,\n\t'uint16': getUint16,\n\t'uint8': getUint8,\n\t'uint8c': getUint8c,\n\t'generic': getGeneric,\n\t'default': getArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an element from a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var arr = new Float64Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat64( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat64( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Float32Array from '@stdlib/array-float32';\n*\n* var arr = new Float32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getFloat32( arr, 2 );\n* // returns 3.0\n*/\nfunction getFloat32( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int32Array from '@stdlib/array-int32';\n*\n* var arr = new Int32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt32( arr, 2 );\n* // returns 3\n*/\nfunction getInt32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int16Array from '@stdlib/array-int16';\n*\n* var arr = new Int16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt16( arr, 2 );\n* // returns 3\n*/\nfunction getInt16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Int8Array from '@stdlib/array-int8';\n*\n* var arr = new Int8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getInt8( arr, 2 );\n* // returns 3\n*/\nfunction getInt8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint32Array from '@stdlib/array-uint32';\n*\n* var arr = new Uint32Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint32( arr, 2 );\n* // returns 3\n*/\nfunction getUint32( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint16Array from '@stdlib/array-uint16';\n*\n* var arr = new Uint16Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint16( arr, 2 );\n* // returns 3\n*/\nfunction getUint16( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var arr = new Uint8Array( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8( arr, 2 );\n* // returns 3\n*/\nfunction getUint8( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {number} element value\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array-uint8c';\n*\n* var arr = new Uint8ClampedArray( [ 1, 2, 3, 4 ] );\n*\n* var v = getUint8c( arr, 2 );\n* // returns 3\n*/\nfunction getUint8c( arr, idx ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from a generic `Array`.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getGeneric( arr, 2 );\n* // returns 3\n*/\nfunction getGeneric( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n/**\n* Returns an element from an indexed array-like object.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @returns {*} element value\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var v = getArrayLike( arr, 2 );\n* // returns 3\n*/\nfunction getArrayLike( arr, idx ) {\n\treturn arr[ idx ];\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for retrieving an element from an indexed array-like object.\n*\n* @param {string} dtype - array dtype\n* @returns {Function} accessor\n*\n* @example\n* import dtype from '@stdlib/array-dtype';\n*\n* var arr = [ 1, 2, 3, 4 ];\n*\n* var get = getter( dtype( arr ) );\n* var v = get( arr, 2 );\n* // returns 3\n*/\nfunction getter( dtype ) {\n\tvar f = GETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn GETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default getter;\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// Mapping from array constructors to data types...\nvar ctor2dtypes = {\n\t'Float32Array': 'float32',\n\t'Float64Array': 'float64',\n\t'Array': 'generic',\n\t'Int16Array': 'int16',\n\t'Int32Array': 'int32',\n\t'Int8Array': 'int8',\n\t'Uint16Array': 'uint16',\n\t'Uint32Array': 'uint32',\n\t'Uint8Array': 'uint8',\n\t'Uint8ClampedArray': 'uint8c',\n\t'Complex64Array': 'complex64',\n\t'Complex128Array': 'complex128'\n};\n\n\n// EXPORTS //\n\nexport default ctor2dtypes;\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 hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat64Array;\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 main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* import ctor from '@stdlib/array-float64';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat64ArraySupport from '@stdlib/assert-has-float64array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isFloat64Array from '@stdlib/assert-is-float64array';\nimport GlobalFloat64Array from './float64array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasFloat64ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat32Array;\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 main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* import ctor from '@stdlib/array-float32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat32ArraySupport from '@stdlib/assert-has-float32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isFloat32Array from '@stdlib/assert-is-float32array';\nimport PINF from '@stdlib/constants-float64-pinf';\nimport GlobalFloat32Array from './float32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasFloat32ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint32Array;\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 unsigned 32-bit integer.\n*\n* @module @stdlib/constants-uint32-max\n* @type {uinteger32}\n*\n* @example\n* import UINT32_MAX from '@stdlib/constants-uint32-max';\n* // returns 4294967295\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar UINT32_MAX = 4294967295;\n\n\n// EXPORTS //\n\nexport default UINT32_MAX;\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 main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* import ctor from '@stdlib/array-uint32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint32ArraySupport from '@stdlib/assert-has-uint32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint32Array from '@stdlib/assert-is-uint32array';\nimport UINT32_MAX from '@stdlib/constants-uint32-max';\nimport GlobalUint32Array from './uint32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint32ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt32Array;\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 signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-max\n* @type {integer32}\n*\n* @example\n* import INT32_MAX from '@stdlib/constants-int32-max';\n* // returns 2147483647\n*/\n\n\n// MAIN //\n\n/**\n* Maximum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{31} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 01111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 2147483647\n*/\nvar INT32_MAX = 2147483647|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT32_MAX;\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 main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* import ctor from '@stdlib/array-int32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt32ArraySupport from '@stdlib/assert-has-int32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isInt32Array from '@stdlib/assert-is-int32array';\nimport INT32_MAX from '@stdlib/constants-int32-max';\nimport INT32_MIN from '@stdlib/constants-int32-min';\nimport GlobalInt32Array from './int32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt32ArraySupport;\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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* import INT32_MIN from '@stdlib/constants-int32-min';\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT32_MIN;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint16Array;\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 unsigned 16-bit integer.\n*\n* @module @stdlib/constants-uint16-max\n* @type {integer32}\n*\n* @example\n* import UINT16_MAX from '@stdlib/constants-uint16-max';\n* // returns 65535\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{16} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 1111111111111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 65535\n*/\nvar UINT16_MAX = 65535|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UINT16_MAX;\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 main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* import ctor from '@stdlib/array-uint16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint16ArraySupport from '@stdlib/assert-has-uint16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint16Array from '@stdlib/assert-is-uint16array';\nimport UINT16_MAX from '@stdlib/constants-uint16-max';\nimport GlobalUint16Array from './uint16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint16ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt16Array;\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 signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-max\n* @type {integer32}\n*\n* @example\n* import INT16_MAX from '@stdlib/constants-int16-max';\n* // returns 32767\n*/\n\n\n// MAIN //\n\n/**\n* Maximum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{15} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 0111111111111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 32767\n*/\nvar INT16_MAX = 32767|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT16_MAX;\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 main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* import ctor from '@stdlib/array-int16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt16ArraySupport from '@stdlib/assert-has-int16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isInt16Array from '@stdlib/assert-is-int16array';\nimport INT16_MAX from '@stdlib/constants-int16-max';\nimport INT16_MIN from '@stdlib/constants-int16-min';\nimport GlobalInt16Array from './int16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt16ArraySupport;\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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* import INT16_MIN from '@stdlib/constants-int16-min';\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT16_MIN;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8Array;\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 unsigned 8-bit integer.\n*\n* @module @stdlib/constants-uint8-max\n* @type {integer32}\n*\n* @example\n* import UINT8_MAX from '@stdlib/constants-uint8-max';\n* // returns 255\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 8-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{8} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 255\n*/\nvar UINT8_MAX = 255|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UINT8_MAX;\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 main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* import ctor from '@stdlib/array-uint8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ArraySupport from '@stdlib/assert-has-uint8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint8Array from '@stdlib/assert-is-uint8array';\nimport UINT8_MAX from '@stdlib/constants-uint8-max';\nimport GlobalUint8Array from './uint8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8ClampedArray;\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 main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* import ctor from '@stdlib/array-uint8c';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ClampedArraySupport from '@stdlib/assert-has-uint8clampedarray-support'; // eslint-disable-line id-length\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isUint8ClampedArray from '@stdlib/assert-is-uint8clampedarray';\nimport GlobalUint8ClampedArray from './uint8clampedarray.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasUint8ClampedArraySupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\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 signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-max\n* @type {integer32}\n*\n* @example\n* import INT8_MAX from '@stdlib/constants-int8-max';\n* // returns 127\n*/\n\n\n// MAIN //\n\n/**\n* Maximum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* 2^{7} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 01111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 127\n*/\nvar INT8_MAX = 127|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MAX;\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 main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* import ctor from '@stdlib/array-int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert-has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isInt8Array from '@stdlib/assert-is-int8array';\nimport INT8_MAX from '@stdlib/constants-int8-max';\nimport INT8_MIN from '@stdlib/constants-int8-min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasInt8ArraySupport;\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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants-int8-min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\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: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 an array-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is an array-like object\n*\n* @example\n* var bool = isArrayLikeObject( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( { 'length':10 } );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( 'beep' );\n* // returns false\n*/\nfunction isArrayLikeObject( 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 isArrayLikeObject;\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 hasArrayBuffer = ( typeof ArrayBuffer === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an ArrayBuffer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an ArrayBuffer\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var bool = isArrayBuffer( new ArrayBuffer( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isArrayBuffer( [] );\n* // returns false\n*/\nfunction isArrayBuffer( value ) {\n\treturn (\n\t\t( hasArrayBuffer && value instanceof ArrayBuffer ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object ArrayBuffer]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArrayBuffer;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isObject;\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 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' );\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'use strict';\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nexport default valueOf;\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 test from './try2valueof.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\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 String]' );\n\t}\n\treturn false;\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'use strict';\n\n// MODULES //\n\nimport valueOf from './valueof.js'; // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.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 string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\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'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert-is-number';\nimport defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 128-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex128} 128-bit complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex128( real, imag ) {\n\tif ( !( this instanceof Complex128 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': real\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': imag\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex128.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 16\n*/\nsetReadOnly( Complex128.prototype, 'byteLength', 16 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex128.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.\n*\n* @name toJSON\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex128.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex128;\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 string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* import isString from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* import { isObject as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* import { isPrimitive as isString } from '@stdlib/assert-is-string';\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex128';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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 fround = ( typeof Math.fround === 'function' ) ? Math.fround : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default fround;\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 Float32Array from '@stdlib/array-float32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest single-precision floating-point number\n*\n* @example\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\nfunction float64ToFloat32( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn FLOAT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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* Convert a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @module @stdlib/number-float64-base-to-float32\n*\n* @example\n* import float64ToFloat32 from '@stdlib/number-float64-base-to-float32';\n*\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar float64ToFloat32;\nif ( typeof builtin === 'function' ) {\n\tfloat64ToFloat32 = builtin;\n} else {\n\tfloat64ToFloat32 = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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 defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport float64ToFloat32 from '@stdlib/number-float64-base-to-float32';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( real )\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( imag )\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex64;\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 Complex128 from '@stdlib/complex-float64-ctor';\nimport Complex64 from '@stdlib/complex-float32-ctor';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a complex number-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex number-like object.\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n*\n* var x = new Complex128( 4.0, 2.0 );\n* var bool = isComplexLike( x );\n* // returns true\n*\n* x = new Complex64( 4.0, 2.0 );\n* bool = isComplexLike( x );\n* // returns true\n*/\nfunction isComplexLike( value ) {\n\tif ( value instanceof Complex128 || value instanceof Complex64 ) {\n\t\treturn true;\n\t}\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.re === 'number' &&\n\t\ttypeof value.im === 'number'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplexLike;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a finite numeric value is an even number.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an even number\n*\n* @example\n* var bool = isEven( 5.0 );\n* // returns false\n*\n* @example\n* var bool = isEven( -2.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( 0.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( NaN );\n* // returns false\n*/\nfunction isEven( x ) {\n\treturn isInteger( x/2.0 );\n}\n\n\n// EXPORTS //\n\nexport default isEven;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 8; // 4 bytes per float32 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex64Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex64Array`\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n*\n* var bool = isComplex64Array( new Complex64Array( 10 ) );\n* // returns true\n*\n* bool = isComplex64Array( [] );\n* // returns false\n*/\nfunction isComplex64Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex64Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex64array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex64Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex64Array;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 16; // 8 bytes per float64 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex128Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex128Array`\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var bool = isComplex128Array( new Complex128Array( 10 ) );\n* // returns true\n*\n* bool = isComplex128Array( [] );\n* // returns false\n*/\nfunction isComplex128Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex128Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex128array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex128Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex128Array;\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 Symbol from '@stdlib/symbol-ctor';\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.iterator` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.iterator` support\n*\n* @example\n* var bool = hasIteratorSymbolSupport();\n* // returns \n*/\nfunction hasIteratorSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol' &&\n\t\thasOwnProp( Symbol, 'iterator' ) &&\n\t\ttypeof Symbol.iterator === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasIteratorSymbolSupport;\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 hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\n\n\n// MAIN //\n\n/**\n* Iterator symbol.\n*\n* @name IteratorSymbol\n* @constant\n* @type {(symbol|null)}\n*\n* @example\n* function iterator() {\n* var it;\n* var i;\n*\n* i = -1;\n*\n* it = {};\n* it.next = next;\n* it.return = done;\n*\n* if ( IteratorSymbol ) {\n* it[ IteratorSymbol ] = iterator;\n* }\n* return it;\n*\n* function next() {\n* i += 1;\n* return {\n* 'value': i,\n* 'done': false\n* };\n* }\n*\n* function done( value ) {\n* if ( arguments.length === 0 ) {\n* return {\n* 'done': true\n* };\n* }\n* return {\n* 'value': value,\n* 'done': true\n* };\n* }\n* }\n*\n* var obj = iterator();\n*/\nvar IteratorSymbol = ( hasIteratorSymbolSupport() ) ? Symbol.iterator : null;\n\n\n// EXPORTS //\n\nexport default IteratorSymbol;\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 accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - accessor\n*\n* @example\n* function getter() {\n* return 'bar';\n* }\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnlyAccessor( obj, 'foo', getter );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnlyAccessor( obj, prop, getter ) { // eslint-disable-line id-length\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'get': getter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnlyAccessor;\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 defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport float64ToFloat32 from '@stdlib/number-float64-base-to-float32';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( real )\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': float64ToFloat32( imag )\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex64;\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* Returns the real component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var re = realf( z );\n* // returns 5.0\n*/\nfunction realf( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default realf;\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* Returns the imaginary component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var im = imagf( z );\n* // returns 3.0\n*/\nfunction imagf( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imagf;\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 Float32Array from '@stdlib/array-float32';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex64Array` as a `Float32Array`.\n*\n* @param {Complex64Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float32Array} `Float32Array` view\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n*\n* var x = new Complex64Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 Float64Array from '@stdlib/array-float64';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex128Array` as a `Float64Array`.\n*\n* @param {Complex128Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float64Array} `Float64Array` view\n*\n* @example\n* import Complex128Array from '@stdlib/array-complex128';\n*\n* var x = new Complex128Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isCollection from '@stdlib/assert-is-collection';\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport isObject from '@stdlib/assert-is-object';\nimport isArray from '@stdlib/assert-is-array';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isEven from '@stdlib/math-base-assert-is-even';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\nimport ITERATOR_SYMBOL from '@stdlib/symbol-iterator';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport Float32Array from '@stdlib/array-float32';\nimport Complex64 from '@stdlib/complex-float32';\nimport format from '@stdlib/string-format';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\nimport floor from '@stdlib/math-base-special-floor';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport getter from '@stdlib/array-base-getter';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\nimport fromArray from './from_array.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Float32Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex64Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex64Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex128Array...\n\t\tvalue.name === 'Complex128Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float32Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex64} complex number\n*/\nfunction getComplex64( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex64( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 64-bit complex number array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {RangeError} ArrayBuffer byte length must be a multiple of `8`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} byte offset must be a multiple of `8`\n* @throws {TypeError} view length must be a positive multiple of `8`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} complex number array\n*\n* @example\n* var arr = new Complex64Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex64Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex64Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Complex64Array( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Complex64Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex64Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex64Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex64Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex64Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex64Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex64Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex64Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float32Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float32Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float32Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float32Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float32Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) ); // FIXME: `buf` is what is returned from above, NOT the original value\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arguments[0] ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64Array\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var nbytes = Complex64Array.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex64Array\n* @readonly\n* @type {string}\n* @default 'Complex64Array'\n*\n* @example\n* var str = Complex64Array.name;\n* // returns 'Complex64Array'\n*/\nsetReadOnly( Complex64Array, 'name', 'Complex64Array' );\n\n/**\n* Creates a new 64-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex64Array\n* @type {Function}\n* @param {(Collection|Iterable)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function clbk( v ) {\n* return new Complex64( realf(v)*2.0, imagf(v)*2.0 );\n* }\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex64Array, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.', 2, len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n});\n\n/**\n* Creates a new 64-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex64Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex64Array, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var z = arr.at( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 0.0\n*\n* var im = imagf( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns -1.0\n*\n* z = arr.at( -1 );\n* // returns \n*\n* re = realf( z );\n* // returns 9.0\n*\n* im = imagf( z );\n* // returns -9.0\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex64( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 80\n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array.prototype, 'BYTES_PER_ELEMENT', Complex64Array.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} modified array\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex64( 1.0, 1.0 ), 0 );\n* arr.set( new Complex64( 2.0, 2.0 ), 1 );\n* arr.set( new Complex64( 3.0, 3.0 ), 2 );\n* arr.set( new Complex64( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* // Get the last array element:\n* var z = arr.get( 3 );\n*\n* var re = realf( z );\n* // returns 2.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex64Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*2 );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = [\n* new Complex64( 1.0, 1.0 ),\n* new Complex64( 2.0, 2.0 ),\n* new Complex64( 3.0, 3.0 )\n* ];\n* arr = new Complex64Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'entries', function entries() {\n\tvar buffer;\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tself = this;\n\tbuffer = this._buffer;\n\tlen = this._length;\n\n\t// Initialize the iteration indices:\n\ti = -1;\n\tj = -2;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\tvar z;\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj += 2;\n\t\tz = new Complex64( buffer[ j ], buffer[ j+1 ] );\n\t\treturn {\n\t\t\t'value': [ i, z ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, getComplex64( buf, i ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.fill( new Complex64( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 1.0\n*\n* z = arr.get( 1 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tre = realf( value );\n\tim = imagf( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 1\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 2.0\n*\n* var im = imagf( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex64Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import Complex64 from '@stdlib/complex-float32';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex64Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import Complex64 from '@stdlib/complex-float32';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns \n*\n* var re = realf( z );\n* // returns 3.0\n*\n* var im = imagf( z );\n* // returns 3.0\n*/\nsetReadOnly( Complex64Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex64Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex64( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 0.0\n*\n* var im = imagf( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns -1.0\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex64( this._buffer, idx );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex64( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex64( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex64( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 10 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex64( 4.0, -4.0 ), -3 );\n* // returns -1\n*/\nsetReadOnly( Complex64Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex64( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex64Array.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import Complex64 from '@stdlib/complex-float32';\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function scale( v, i ) {\n* return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 2\n*\n* var im = imagf( z );\n* // returns -2\n*/\nsetReadOnly( Complex64Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = fcn.call( thisArg, getComplex64( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = realf( v );\n\t\t\toutbuf[ (2*i)+1 ] = imagf( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import caddf from '@stdlib/math-base-ops-caddf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( caddf );\n* // returns \n*\n* var re = realf( z );\n* // returns 6.0\n*\n* var im = imagf( z );\n* // returns 6.0\n*/\nsetReadOnly( Complex64Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = getComplex64( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex64( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 3.0\n*\n* var im = imagf( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n*\n* @name set\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 0.0\n*\n* var im = imagf( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns -1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = realf( value );\n\t\tbuf[ idx+1 ] = imagf( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( value ) ) {\n\t\tN = value._length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tsbuf = value._buffer;\n\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Float32Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float32Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = realf( v );\n\t\t\tbuf[ idx+1 ] = imagf( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns -1.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 5.0\n*\n* im = imagf( z );\n* // returns -5.0\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* z = out.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns -2.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 3.0\n*\n* im = imagf( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex64Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( start < end ) {\n\t\toutlen = end - start;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, getComplex64( buf, i ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var z = subarr.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 1.0\n*\n* var im = imagf( z );\n* // returns -1.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 5.0\n*\n* im = imagf( z );\n* // returns -5.0\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* z = subarr.get( 0 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns -2.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = realf( z );\n* // returns 3.0\n*\n* im = imagf( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex64Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + (begin*BYTES_PER_ELEMENT);\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 3.0\n*\n* var im = imagf( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = realf( z );\n* // returns 2.0\n*\n* im = imagf( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = realf( z );\n* // returns 1.0\n*\n* im = imagf( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex64Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a complex number\n* @returns {Complex64Array} new typed array\n*\n* @example\n* import realf from '@stdlib/complex-realf';\n* import imagf from '@stdlib/complex-imagf';\n* import Complex64 from '@stdlib/complex-float32';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex64( 4.0, 4.0 ) );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = realf( z );\n* // returns 4.0\n*\n* var im = imagf( z );\n* // returns 4.0\n*/\nsetReadOnly( Complex64Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = realf( value );\n\tbuf[ (2*index)+1 ] = imagf( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex64Array;\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 isComplexLike from '@stdlib/assert-is-complex-like';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float32Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float32Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = realf( v );\n\t\tbuf[ j+1 ] = imagf( v );\n\t\tj += 2; // stride\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\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 defineProperty from '@stdlib/utils-define-property';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport format from '@stdlib/string-format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 128-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex128} 128-bit complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex128( real, imag ) {\n\tif ( !( this instanceof Complex128 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tdefineProperty( this, 're', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': real\n\t});\n\tdefineProperty( this, 'im', {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': imag\n\t});\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex128.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 16\n*/\nsetReadOnly( Complex128.prototype, 'byteLength', 16 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex128.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.\n*\n* @name toJSON\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex128.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex128;\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* Returns the real component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport format from '@stdlib/string-format';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport realf from '@stdlib/complex-realf';\nimport imagf from '@stdlib/complex-imagf';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex128';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isCollection from '@stdlib/assert-is-collection';\nimport isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport isObject from '@stdlib/assert-is-object';\nimport isArray from '@stdlib/assert-is-array';\nimport isString from '@stdlib/assert-is-string';\nimport isFunction from '@stdlib/assert-is-function';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport isEven from '@stdlib/math-base-assert-is-even';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport isComplex64Array from '@stdlib/array-base-assert-is-complex64array';\nimport isComplex128Array from '@stdlib/array-base-assert-is-complex128array';\nimport hasIteratorSymbolSupport from '@stdlib/assert-has-iterator-symbol-support';\nimport ITERATOR_SYMBOL from '@stdlib/symbol-iterator';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport Float64Array from '@stdlib/array-float64';\nimport Complex128 from '@stdlib/complex-float64';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\nimport floor from '@stdlib/math-base-special-floor';\nimport reinterpret64 from '@stdlib/strided-base-reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided-base-reinterpret-complex128';\nimport getter from '@stdlib/array-base-getter';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport format from '@stdlib/string-format';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\nimport fromArray from './from_array.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Float64Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex128Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex128Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex64Array...\n\t\tvalue.name === 'Complex64Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float64Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex128} complex number\n*/\nfunction getComplex128( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex128( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 128-bit complex number array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {RangeError} ArrayBuffer byte length must be a multiple of `16`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\n* @throws {TypeError} if provided only a single argument, must provide a valid argument\n* @throws {TypeError} byte offset must be a nonnegative integer\n* @throws {RangeError} byte offset must be a multiple of `16`\n* @throws {TypeError} view length must be a positive multiple of `16`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} complex number array\n*\n* @example\n* var arr = new Complex128Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex128Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex128Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex128Array( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex128Array( buf, 16 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = new Complex128Array( buf, 16, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex128Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex128Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex128Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex128Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex128Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex128Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float64Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float64Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float64Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float64Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float64Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arguments[0] ) );\n\t\t}\n\t} else {\n\t\tbuf = arguments[ 0 ];\n\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t}\n\t\tbyteOffset = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t}\n\t\tif ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf, byteOffset );\n\t\t} else {\n\t\t\tlen = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t}\n\t\t\tif ( (len*BYTES_PER_ELEMENT) > (buf.byteLength-byteOffset) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len*BYTES_PER_ELEMENT ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128Array\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var nbytes = Complex128Array.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex128Array\n* @readonly\n* @type {string}\n* @default 'Complex128Array'\n*\n* @example\n* var name = Complex128Array.name;\n* // returns 'Complex128Array'\n*/\nsetReadOnly( Complex128Array, 'name', 'Complex128Array' );\n\n/**\n* Creates a new 128-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex128Array\n* @type {Function}\n* @param {(Collection|Object)} src - array-like object or iterable\n* @param {Function} [clbk] - callback to invoke for each source element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function clbk( v ) {\n* return new Complex128( real(v)*2.0, imag(v)*2.0 );\n* }\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex128Array, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\n\tvar get;\n\tvar len;\n\tvar flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\n\t\t\tlen = src.length;\n\t\t\tif ( src.get && src.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( buf.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIterator( buf );\n\t\t}\n\t\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\n\t\tout = new this( len );\n\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tbuf[ i ] = tmp[ i ];\n\t\t}\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n});\n\n/**\n* Creates a new 128-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex128Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex128Array, 'of', function of() {\n\tvar args;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\targs = [];\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn new this( args );\n});\n\n/**\n* Returns an array element with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.at( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 0.0\n*\n* var im = imag( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns -1.0\n*\n* z = arr.at( -1 );\n* // returns \n*\n* re = real( z );\n* // returns 9.0\n*\n* im = imag( z );\n* // returns -9.0\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex128( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'buffer', function get() {\n\treturn this._buffer.buffer;\n});\n\n/**\n* Size (in bytes) of the array.\n*\n* @name byteLength\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 160\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'byteLength', function get() {\n\treturn this._buffer.byteLength;\n});\n\n/**\n* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n*\n* @name byteOffset\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'byteOffset', function get() {\n\treturn this._buffer.byteOffset;\n});\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array.prototype, 'BYTES_PER_ELEMENT', Complex128Array.BYTES_PER_ELEMENT );\n\n/**\n* Copies a sequence of elements within the array to the position starting at `target`.\n*\n* @name copyWithin\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} target - index at which to start copying elements\n* @param {integer} start - source index at which to copy elements from\n* @param {integer} [end] - source index at which to stop copying elements from\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} modified array\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex128( 1.0, 1.0 ), 0 );\n* arr.set( new Complex128( 2.0, 2.0 ), 1 );\n* arr.set( new Complex128( 3.0, 3.0 ), 2 );\n* arr.set( new Complex128( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* // Get the last array element:\n* var z = arr.get( 3 );\n*\n* var re = real( z );\n* // returns 2.0\n*\n* var im = imag( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex128Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\t// FIXME: prefer a functional `copyWithin` implementation which addresses lack of universal browser support (e.g., IE11 and Safari) or ensure that typed arrays are polyfilled\n\tif ( arguments.length === 2 ) {\n\t\tthis._buffer.copyWithin( target*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*2 );\n\t}\n\treturn this;\n});\n\n/**\n* Returns an iterator for iterating over array key-value pairs.\n*\n* @name entries\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = [\n* new Complex128( 1.0, 1.0 ),\n* new Complex128( 2.0, 2.0 ),\n* new Complex128( 3.0, 3.0 )\n* ];\n* arr = new Complex128Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'entries', function entries() {\n\tvar buffer;\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tself = this;\n\tbuffer = this._buffer;\n\tlen = this._length;\n\n\t// Initialize the iteration indices:\n\ti = -1;\n\tj = -2;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\tif ( ITERATOR_SYMBOL ) {\n\t\tsetReadOnly( iter, ITERATOR_SYMBOL, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\tvar z;\n\t\ti += 1;\n\t\tif ( FLG || i >= len ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj += 2;\n\t\tz = new Complex128( buffer[ j ], buffer[ j+1 ] );\n\t\treturn {\n\t\t\t'value': [ i, z ],\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn self.entries();\n\t}\n});\n\n/**\n* Tests whether all elements in an array pass a test implemented by a predicate function.\n*\n* @name every\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether all elements pass a test\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( !predicate.call( thisArg, getComplex128( buf, i ), i, this ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n});\n\n/**\n* Returns a modified typed array filled with a fill value.\n*\n* @name fill\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} value - fill value\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.fill( new Complex128( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns 1.0\n*\n* z = arr.get( 1 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length > 2 ) {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t} else {\n\t\t\tend = len;\n\t\t}\n\t} else {\n\t\tstart = 0;\n\t\tend = len;\n\t}\n\tre = real( value );\n\tim = imag( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\n\t}\n\treturn this;\n});\n\n/**\n* Returns a new array containing the elements of an array which pass a test implemented by a predicate function.\n*\n* @name filter\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 1\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 2.0\n*\n* var im = imag( z );\n* // returns 2.0\n*/\nsetReadOnly( Complex128Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\n\t\t}\n\t}\n\treturn new this.constructor( out );\n});\n\n/**\n* Returns the first element in an array for which a predicate function returns a truthy value.\n*\n* @name find\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the first element in an array for which a predicate function returns a truthy value.\n*\n* @name findIndex\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex128Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLast\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns \n*\n* var re = real( z );\n* // returns 3.0\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nsetReadOnly( Complex128Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\n\t\t}\n\t}\n});\n\n/**\n* Returns the index of the last element in an array for which a predicate function returns a truthy value.\n*\n* @name findLastIndex\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = this._length-1; i >= 0; i-- ) {\n\t\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Invokes a function once for each array element.\n*\n* @name forEach\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex128Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tz = getComplex128( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* var arr = new Complex128Array( 10 );\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 0.0\n*\n* var im = imag( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns -1.0\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isNonNegativeInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex128( this._buffer, idx );\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex128( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex128( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex128( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @name indexOf\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex128( 4.0, -4.0 ), -3 );\n* // returns 3\n*/\nsetReadOnly( Complex128Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t\tif ( fromIndex < 0 ) {\n\t\t\t\tfromIndex = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfromIndex = 0;\n\t}\n\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new string by concatenating all array elements.\n*\n* @name join\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns the last index at which a given element can be found.\n*\n* @name lastIndexOf\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex128( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex128( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. Value: `%s`.', searchElement ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= this._length ) {\n\t\t\tfromIndex = this._length - 1;\n\t\t} else if ( fromIndex < 0 ) {\n\t\t\tfromIndex += this._length;\n\t\t}\n\t} else {\n\t\tfromIndex = this._length - 1;\n\t}\n\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n});\n\n/**\n* Returns a new array with each element being the result of a provided callback function.\n*\n* @name map\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64';\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function scale( v, i ) {\n* return new Complex128( 2.0*real( v ), 2.0*imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 2.0\n*\n* var im = imag( z );\n* // returns -2.0\n*/\nsetReadOnly( Complex128Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tbuf = this._buffer;\n\tout = new this.constructor( this._length );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tv = fcn.call( thisArg, getComplex128( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = real( v );\n\t\t\toutbuf[ (2*i)+1 ] = imag( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\n\t}\n\treturn out;\n});\n\n/**\n* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.\n*\n* @name reduce\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @throws {Error} if not provided an initial value, the array must have at least one element\n* @returns {*} accumulated result\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n* import cadd from '@stdlib/math-base-ops-cadd';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( cadd );\n* // returns \n*\n* var re = real( z );\n* // returns 6.0\n*\n* var im = imag( z );\n* // returns 6.0\n*/\nsetReadOnly( Complex128Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( reducer ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', reducer ) );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length > 1 ) {\n\t\tacc = initialValue;\n\t\ti = 0;\n\t} else {\n\t\tif ( len === 0 ) {\n\t\t\tthrow new Error( 'invalid operation. If not provided an initial value, an array must contain at least one element.' );\n\t\t}\n\t\tacc = getComplex128( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex128( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 3.0\n*\n* var im = imag( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n*\n* In the other overlapping scenario,\n*\n* ```text\n* buf: ---------------------\n* src: ---------------------\n* ```\n*\n* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values as intended.\n*\n* @name set\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n* @returns {void}\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 0.0\n*\n* var im = imag( z );\n* // returns 0.0\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns -1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length > 1 ) {\n\t\tidx = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t} else {\n\t\tidx = 0;\n\t}\n\tif ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = real( value );\n\t\tbuf[ idx+1 ] = imag( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( value ) ) {\n\t\tN = value._length;\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tsbuf = value._buffer;\n\n\t\t// Check for overlapping memory...\n\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\tif (\n\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t(\n\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t)\n\t\t) {\n\t\t\t// We need to copy source values...\n\t\t\ttmp = new Float64Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float64Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\n\t\tif ( idx+N > this._length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t}\n\t\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = real( v );\n\t\t\tbuf[ idx+1 ] = imag( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns -1.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 5.0\n*\n* im = imag( z );\n* // returns -5.0\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* z = out.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns -2.0\n*\n* z = out.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 3.0\n*\n* im = imag( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex128Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', start ) );\n\t\t}\n\t\tif ( start < 0 ) {\n\t\t\tstart += len;\n\t\t\tif ( start < 0 ) {\n\t\t\t\tstart = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( start < end ) {\n\t\toutlen = end - start;\n\t} else {\n\t\toutlen = 0;\n\t}\n\tout = new this.constructor( outlen );\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < outlen; i++ ) {\n\t\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Tests whether at least one element in an array passes a test implemented by a predicate function.\n*\n* @name some\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {boolean} boolean indicating whether at least one element passes a test\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tif ( predicate.call( thisArg, getComplex128( buf, i ), i, this ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n});\n\n/**\n* Creates a new typed array view over the same underlying `ArrayBuffer` and with the same underlying data type as the host array.\n*\n* @name subarray\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var z = subarr.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 1.0\n*\n* var im = imag( z );\n* // returns -1.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 5.0\n*\n* im = imag( z );\n* // returns -5.0\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* z = subarr.get( 0 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns -2.0\n*\n* z = subarr.get( len-1 );\n* // returns \n*\n* re = real( z );\n* // returns 3.0\n*\n* im = imag( z );\n* // returns -3.0\n*/\nsetReadOnly( Complex128Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tbegin = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( begin ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', begin ) );\n\t\t}\n\t\tif ( begin < 0 ) {\n\t\t\tbegin += len;\n\t\t\tif ( begin < 0 ) {\n\t\t\t\tbegin = 0;\n\t\t\t}\n\t\t}\n\t\tif ( arguments.length === 1 ) {\n\t\t\tend = len;\n\t\t} else {\n\t\t\tif ( !isInteger( end ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', end ) );\n\t\t\t}\n\t\t\tif ( end < 0 ) {\n\t\t\t\tend += len;\n\t\t\t\tif ( end < 0 ) {\n\t\t\t\t\tend = 0;\n\t\t\t\t}\n\t\t\t} else if ( end > len ) {\n\t\t\t\tend = len;\n\t\t\t}\n\t\t}\n\t}\n\tif ( begin >= len ) {\n\t\tlen = 0;\n\t\toffset = buf.byteLength;\n\t} else if ( begin >= end ) {\n\t\tlen = 0;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t} else {\n\t\tlen = end - begin;\n\t\toffset = buf.byteOffset + ( begin*BYTES_PER_ELEMENT );\n\t}\n\treturn new this.constructor( buf.buffer, offset, ( len < 0 ) ? 0 : len );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 3.0\n*\n* var im = imag( z );\n* // returns 3.0\n*\n* z = out.get( 1 );\n* // returns \n*\n* re = real( z );\n* // returns 2.0\n*\n* im = imag( z );\n* // returns 2.0\n*\n* z = out.get( 2 );\n* // returns \n*\n* re = real( z );\n* // returns 1.0\n*\n* im = imag( z );\n* // returns 1.0\n*/\nsetReadOnly( Complex128Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tout = new this.constructor( len );\n\tbuf = this._buffer;\n\toutbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t}\n\treturn out;\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\n\t}\n\treturn out.join( ',' );\n});\n\n/**\n* Returns a new typed array with the element at a provided index replaced with a provided value.\n*\n* @name with\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {RangeError} index argument is out-of-bounds\n* @throws {TypeError} second argument must be a complex number\n* @returns {Complex128Array} new typed array\n*\n* @example\n* import real from '@stdlib/complex-real';\n* import imag from '@stdlib/complex-imag';\n* import Complex128 from '@stdlib/complex-float64';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex128( 4.0, 4.0 ) );\n* // returns \n*\n* var z = out.get( 0 );\n* // returns \n*\n* var re = real( z );\n* // returns 4.0\n*\n* var im = imag( z );\n* // returns 4.0\n*/\nsetReadOnly( Complex128Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isInteger( index ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an integer. Value: `%s`.', index ) );\n\t}\n\tlen = this._length;\n\tif ( index < 0 ) {\n\t\tindex += len;\n\t}\n\tif ( index < 0 || index >= len ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = real( value );\n\tbuf[ (2*index)+1 ] = imag( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex128Array;\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 isComplexLike from '@stdlib/assert-is-complex-like';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float64Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float64Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = real( v );\n\t\tbuf[ j+1 ] = imag( v );\n\t\tj += 2; // stride\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\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 isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isComplexLike from '@stdlib/assert-is-complex-like';\nimport format from '@stdlib/string-format';\nimport real from '@stdlib/complex-real';\nimport imag from '@stdlib/complex-imag';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\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 Float64Array from '@stdlib/array-float64';\nimport Float32Array from '@stdlib/array-float32';\nimport Uint32Array from '@stdlib/array-uint32';\nimport Int32Array from '@stdlib/array-int32';\nimport Uint16Array from '@stdlib/array-uint16';\nimport Int16Array from '@stdlib/array-int16';\nimport Uint8Array from '@stdlib/array-uint8';\nimport Uint8ClampedArray from '@stdlib/array-uint8c';\nimport Int8Array from '@stdlib/array-int8';\nimport Complex64Array from '@stdlib/array-complex64';\nimport Complex128Array from '@stdlib/array-complex128';\n\n\n// MAIN //\n\n// Note: order should match `dtypes` order\nvar CTORS = [\n\tFloat64Array,\n\tFloat32Array,\n\tInt32Array,\n\tUint32Array,\n\tInt16Array,\n\tUint16Array,\n\tInt8Array,\n\tUint8Array,\n\tUint8ClampedArray,\n\tComplex64Array,\n\tComplex128Array\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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// Note: order should match `ctors` order\nvar DTYPES = [\n\t'float64',\n\t'float32',\n\t'int32',\n\t'uint32',\n\t'int16',\n\t'uint16',\n\t'int8',\n\t'uint8',\n\t'uint8c',\n\t'complex64',\n\t'complex128'\n];\n\n\n// EXPORTS //\n\nexport default DTYPES;\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 isBuffer from '@stdlib/assert-is-buffer';\nimport isArray from '@stdlib/assert-is-array';\nimport constructorName from '@stdlib/utils-constructor-name';\nimport ctor2dtype from './ctor2dtype.js';\nimport CTORS from './ctors.js';\nimport DTYPES from './dtypes.js';\n\n\n// VARIABLES //\n\nvar NTYPES = DTYPES.length;\n\n\n// MAIN //\n\n/**\n* Returns the data type of an array.\n*\n* @param {*} value - input value\n* @returns {(string|null)} data type\n*\n* @example\n* var dt = dtype( [ 1, 2, 3 ] );\n* // returns 'generic'\n*\n* var dt = dtype( 'beep' );\n* // returns null\n*/\nfunction dtype( value ) {\n\tvar i;\n\tif ( isArray( value ) ) {\n\t\treturn 'generic';\n\t}\n\tif ( isBuffer( value ) ) {\n\t\treturn null;\n\t}\n\tfor ( i = 0; i < NTYPES; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn DTYPES[ i ];\n\t\t}\n\t}\n\t// If the above failed, fall back to a more robust (and significantly slower) means for resolving underlying data types:\n\treturn ctor2dtype[ constructorName( value ) ] || null;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isCollection from '@stdlib/assert-is-collection';\nimport isAccessorArray from '@stdlib/array-base-assert-is-accessor-array';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport dtype from '@stdlib/array-dtype';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns a function to tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @throws {TypeError} must provide an array-like object\n* @returns {Function} function to test if an array contains a search value\n*\n* @example\n* var contains = factory( [ 1, 2, 3 ] );\n* // returns \n*\n* var bool = contains( 2 );\n* // returns true\n*/\nfunction factory( x ) {\n\tvar get;\n\tvar len;\n\tvar dt;\n\n\tif ( !isCollection( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', x ) );\n\t}\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\treturn ( get === void 0 ) ? contains : accessors;\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*\n\t* @example\n\t* var out = contains( [ 1, 2, 3 ], 2 );\n\t* // returns true\n\t*/\n\tfunction contains( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( x[ i ] === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*/\n\tfunction accessors( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( get( x, i ) === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\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* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {RegExp} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string-base-capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 an array contains a provided search value.\n*\n* @module @stdlib/array-base-assert-contains\n*\n* @example\n* import contains from '@stdlib/array-base-assert-contains';\n*\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"factory\": \"main.factory\" }\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 isAccessorArray from '@stdlib/array-base-assert-is-accessor-array';\nimport accessorGetter from '@stdlib/array-base-accessor-getter';\nimport getter from '@stdlib/array-base-getter';\nimport dtype from '@stdlib/array-dtype';\n\n\n// MAIN //\n\n/**\n* Tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @param {*} value - search value\n* @returns {boolean} boolean indicating if an array contains a search value\n*\n* @example\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\nfunction contains( x, value ) {\n\tvar len;\n\tvar get;\n\tvar dt;\n\tvar i;\n\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t} else {\n\t\tget = getter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\t// Loop over the elements...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( get( x, i ) === value ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default contains;\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 replace from '@stdlib/string-base-replace';\nimport DTYPES from './dtypes.json';\n\n\n// VARIABLES //\n\nvar RE_SUFFIX = /_and_generic$/;\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray data types.\n*\n* @param {string} [kind] - data type kind\n* @returns {StringArray} list of ndarray data types\n*\n* @example\n* var list = dtypes();\n* // returns [...]\n*\n* @example\n* var list = dtypes( 'floating_point' );\n* // returns [...]\n*/\nfunction dtypes() {\n\tvar kind;\n\tvar out;\n\tvar FLG;\n\tif ( arguments.length === 0 ) {\n\t\treturn DTYPES.all.slice();\n\t}\n\tFLG = false;\n\tkind = arguments[ 0 ];\n\tif ( RE_SUFFIX.test( kind ) ) {\n\t\tkind = replace( kind, RE_SUFFIX, '' );\n\t\tif ( kind !== 'all' ) {\n\t\t\tFLG = true;\n\t\t}\n\t}\n\tout = DTYPES[ kind ];\n\tout = ( out ) ? out.slice() : [];\n\tif ( FLG && out.length > 0 ) {\n\t\tout.push( 'generic' );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default dtypes;\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/* eslint-disable stdlib/empty-line-before-comment */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns an object mapping supported data type strings to enumeration constants.\n*\n* ## Notes\n*\n* - Downstream consumers of this mapping should **not** rely on specific integer values (e.g., `INT8 == 0`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects. While certain dtypes, such as \"generic\" and \"binary\", have special behavior in JavaScript, they do not have a direct complement in C.\n*\n* @private\n* @returns {Object} object mapping supported dtypes to enumeration constants\n*\n* @example\n* var table = enumeration();\n* // returns \n*/\nfunction enumeration() {\n\t// NOTE: the following should match the C `dtypes.h` enumeration!!!!\n\treturn {\n\t\t// Boolean data types:\n\t\t'bool': 0,\n\n\t\t// Integer data types:\n\t\t'int8': 1,\n\t\t'uint8': 2,\n\t\t'uint8c': 3,\n\t\t'int16': 4,\n\t\t'uint16': 5,\n\t\t'int32': 6,\n\t\t'uint32': 7,\n\t\t'int64': 8,\n\t\t'uint64': 9,\n\t\t// 'int128': 10, // uncomment once supported\n\t\t// 'uint128': 11,\n\t\t// 'int256': 12,\n\t\t// 'uint256': 13,\n\n\t\t// Floating-point data types:\n\t\t// 'float16': 14,\n\t\t// 'bfloat16': 15,\n\t\t'float32': 10,\n\t\t'float64': 11,\n\t\t// 'float128': 18, // uncomment once supported\n\n\t\t// Complex floating-point number data types:\n\t\t'complex64': 12,\n\t\t'complex128': 13,\n\n\t\t// Data type for \"binary\" data (i.e., data stored in a Node.js `Buffer` object):\n\t\t'binary': 14,\n\n\t\t// Data type for \"generic\" JavaScript values (objects):\n\t\t'generic': 15,\n\n\t\t// Define a signaling value which is guaranteed not to be a valid type enumeration value:\n\t\t'notype': 17,\n\n\t\t// Indicate the start of user defined type numbers (leaving room for type growth above):\n\t\t'userdefined_type': 256\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumeration;\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 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* setReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setReadOnly;\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 an array of an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 bool = ( typeof Object.keys !== 'undefined' );\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// MODULES //\n\nimport isArguments from './main.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\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// MODULES //\n\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\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 if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 isNan from '@stdlib/math-base-assert-is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 isNan from '@stdlib/math-base-assert-is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* import isnan from '@stdlib/assert-is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isnan } from '@stdlib/assert-is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* import { isObject as isnan } from '@stdlib/assert-is-nan';\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\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\n/**\n* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\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 isEnum from './native.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\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// MODULES //\n\nimport isString from '@stdlib/assert-is-string';\nimport { isPrimitive as isnan } from '@stdlib/assert-is-nan';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport isEnum from './native.js';\nimport hasStringEnumBug from './has_string_enumerability_bug.js';\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default isEnumerableProperty;\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 `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* import isArguments from '@stdlib/assert-is-arguments';\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nimport hasArgumentsClass from './detect.js';\nimport main from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport isArray from '@stdlib/assert-is-array';\nimport isInteger from '@stdlib/math-base-assert-is-integer';\nimport MAX_LENGTH from '@stdlib/constants-uint32-max';\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isArguments;\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 isArguments from '@stdlib/assert-is-arguments';\nimport builtin from './builtin.js';\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\nimport noop from '@stdlib/utils-noop';\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\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/**\n* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nexport default noop;\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 isEnumerableProperty from '@stdlib/assert-is-enumerable-property';\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\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// MODULES //\n\nimport isnan from '@stdlib/assert-is-nan';\nimport isCollection from '@stdlib/assert-is-collection';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} third argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', arr ) );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nexport default indexOf;\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 whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nexport default isConstructorPrototype;\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 w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nexport default w;\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 indexOf from '@stdlib/utils-index-of';\nimport typeOf from '@stdlib/utils-type-of';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport EXCLUDED_KEYS from './excluded_keys.json';\nimport win from './window.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\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// MAIN //\n\nvar bool = ( typeof window !== 'undefined' );\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// MODULES //\n\nimport hasArgumentsBug from './has_arguments_bug.js';\nimport HAS_BUILTIN from './has_builtin.js';\nimport builtin from './builtin.js';\nimport wrapper from './builtin_wrapper.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 keys from './builtin.js';\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\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 isObjectLike from '@stdlib/assert-is-object-like';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isArguments from '@stdlib/assert-is-arguments';\nimport HAS_ENUM_PROTO_BUG from './has_enumerable_prototype_bug.js';\nimport HAS_NON_ENUM_PROPS_BUG from './has_non_enumerable_properties_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype_wrapper.js';\nimport NON_ENUMERABLE from './non_enumerable.json';\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default keys;\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 hasAutomationEqualityBug from './has_automation_equality_bug.js';\nimport isConstructorPrototype from './is_constructor_prototype.js';\nimport HAS_WINDOW from './has_window.js';\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default wrapper;\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 list of ndarray data types.\n*\n* @module @stdlib/ndarray-dtypes\n*\n* @example\n* import dtypes from '@stdlib/ndarray-dtypes';\n*\n* var list = dtypes();\n* // returns [...]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport enumeration from './enum.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'enum', enumeration );\nassign( main, enumeration() );\n\n\n// EXPORTS //\n\nexport default main;\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 setReadOnly from '@stdlib/utils-define-read-only-property';\nimport objectKeys from '@stdlib/utils-keys';\n\n\n// MAIN //\n\n/**\n* Copies all enumerable own properties from a source object to a target object as enumerable read-only properties.\n*\n* @private\n* @param {Object} target - target object\n* @param {Object} source - source object\n* @returns {Object} modified target object\n*\n* @example\n* var source = {\n* 'beep': 'boop'\n* };\n* var target = {};\n*\n* var out = assign( target, source );\n* // returns \n*\n* var bool = ( out === target );\n* // returns true\n*\n* var v = target.beep;\n* // returns 'boop'\n*/\nfunction assign( target, source ) {\n\tvar keys;\n\tvar k;\n\tvar i;\n\n\tkeys = objectKeys( source );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tk = keys[ i ];\n\t\tsetReadOnly( target, k, source[ k ] );\n\t}\n\treturn target;\n}\n\n\n// EXPORTS //\n\nexport default assign;\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 { factory as contains } from '@stdlib/array-base-assert-contains';\nimport dtypes from '@stdlib/ndarray-dtypes';\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is a supported ndarray data type.\n*\n* @name isDataType\n* @type {Function}\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is a supported ndarray data type\n*\n* @example\n* var bool = isDataType( 'binary' );\n* // returns true\n*\n* bool = isDataType( 'float32' );\n* // returns true\n*\n* bool = isDataType( 'float64' );\n* // returns true\n*\n* bool = isDataType( 'generic' );\n* // returns true\n*\n* bool = isDataType( 'int16' );\n* // returns true\n*\n* bool = isDataType( 'int32' );\n* // returns true\n*\n* bool = isDataType( 'int8' );\n* // returns true\n*\n* bool = isDataType( 'uint16' );\n* // returns true\n*\n* bool = isDataType( 'uint32' );\n* // returns true\n*\n* bool = isDataType( 'uint8' );\n* // returns true\n*\n* bool = isDataType( 'uint8c' );\n* // returns true\n*\n* bool = isDataType( 'foo' );\n* // returns false\n*/\nvar isDataType = contains( dtypes() );\n\n\n// EXPORTS //\n\nexport default isDataType;\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* Computes the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @returns {Array} linear indices\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 10, 1 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -10, -1 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 1, 10 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -1, -10 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*/\nfunction minmaxViewBufferIndex( shape, strides, offset ) {\n\tvar ndims;\n\tvar min;\n\tvar max;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tmin = offset;\n\tmax = offset;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( shape[ i ] === 0 ) {\n\t\t\treturn [ offset, offset ];\n\t\t}\n\t\ts = strides[ i ];\n\t\tif ( s > 0 ) {\n\t\t\tmax += s * ( shape[i]-1 );\n\t\t} else if ( s < 0 ) {\n\t\t\tmin += s * ( shape[i]-1 ); // decrements min\n\t\t}\n\t}\n\treturn [ min, max ];\n}\n\n\n// EXPORTS //\n\nexport default minmaxViewBufferIndex;\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* Compute the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view.\n*\n* @module @stdlib/ndarray-base-minmax-view-buffer-index\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ 10, 1 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ -10, -1 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ 1, 10 ];\n* var offset = 10;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 10, 109 ]\n*\n* @example\n* import minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n*\n* var shape = [ 10, 10 ];\n* var strides = [ -1, -10 ];\n* var offset = 99;\n*\n* var idx = minmaxViewBufferIndex( shape, strides, offset );\n* // returns [ 0, 99 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\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* Computes the minimum and maximum linear indices in an underlying data buffer which are accessible to an array view and assigns results to a provided output array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} linear indices\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 10, 1 ];\n* var offset = 10;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 10, 109 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -10, -1 ];\n* var offset = 99;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 0, 99 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ 1, 10 ];\n* var offset = 10;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 10, 109 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*\n* @example\n* var shape = [ 10, 10 ];\n* var strides = [ -1, -10 ];\n* var offset = 99;\n*\n* var out = [ 0, 0 ];\n* var idx = minmaxViewBufferIndex( shape, strides, offset, out );\n* // returns [ 0, 99 ]\n*\n* var bool = ( idx === out );\n* // returns true\n*/\nfunction minmaxViewBufferIndex( shape, strides, offset, out ) {\n\tvar ndims;\n\tvar min;\n\tvar max;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tmin = offset;\n\tmax = offset;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( shape[ i ] === 0 ) {\n\t\t\tout[ 0 ] = offset;\n\t\t\tout[ 1 ] = offset;\n\t\t\treturn out;\n\t\t}\n\t\ts = strides[ i ];\n\t\tif ( s > 0 ) {\n\t\t\tmax += s * ( shape[i]-1 );\n\t\t} else if ( s < 0 ) {\n\t\t\tmin += s * ( shape[i]-1 ); // decrements min\n\t\t}\n\t}\n\tout[ 0 ] = min;\n\tout[ 1 ] = max;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default minmaxViewBufferIndex;\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 getGlobal from '@stdlib/utils-global';\n\n\n// VARIABLES //\n\nvar Global = getGlobal();\n\n\n// MAIN //\n\n/**\n* Tests for native `BigInt` support.\n*\n* @returns {boolean} boolean indicating if an environment has `BigInt` support\n*\n* @example\n* var bool = hasBigIntSupport();\n* // returns \n*/\nfunction hasBigIntSupport() {\n\treturn (\n\t\ttypeof Global.BigInt === 'function' &&\n\t\ttypeof BigInt === 'function' && // eslint-disable-line stdlib/require-globals\n\t\ttypeof Global.BigInt( '1' ) === 'bigint' &&\n\t\ttypeof BigInt( '1' ) === 'bigint' // eslint-disable-line stdlib/require-globals, no-undef\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasBigIntSupport;\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* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\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* Determines if an array is column-major contiguous.\n*\n* @private\n* @param {integer} order - **inferred** array order\n* @param {boolean} contiguous - boolean indicating is an array is contiguous\n* @returns {boolean} boolean indicating if an array is column-major contiguous\n*/\nfunction isColumnMajorContiguous( order, contiguous ) {\n\treturn contiguous && ( order === 2 || order === 3 );\n}\n\n\n// EXPORTS //\n\nexport default isColumnMajorContiguous;\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* Determines if an array is row-major contiguous.\n*\n* @private\n* @param {integer} order - **inferred** array order\n* @param {boolean} contiguous - boolean indicating is an array is contiguous\n* @returns {boolean} boolean indicating if an array is row-major contiguous\n*/\nfunction isRowMajorContiguous( order, contiguous ) {\n\treturn contiguous && ( order === 1 || order === 3 );\n}\n\n\n// EXPORTS //\n\nexport default isRowMajorContiguous;\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* Returns the real component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex128 from '@stdlib/complex-float64-ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a regular expression string. Value: `%s`.', str ) );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default rescape;\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 exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nexport default exec;\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 test from './try2exec.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\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 RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isRegExp;\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 exec from './exec.js';\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.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 rescape from '@stdlib/utils-escape-regexp-string';\nimport isFunction from '@stdlib/assert-is-function';\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport isRegExp from '@stdlib/assert-is-regexp';\nimport format from '@stdlib/string-format';\nimport base from '@stdlib/string-base-replace';\n\n\n// MAIN //\n\n/**\n* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument argument must be a string or regular expression\n* @throws {TypeError} third argument must be a string or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string-capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = new RegExp( rescape( search ), 'g' );\n\t} else if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string or regular expression. Value: `%s`.', search ) );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string or replacement function. Value: `%s`.', newval ) );\n\t}\n\treturn base( str, search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\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 replace from '@stdlib/string-replace';\nimport real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// VARIABLES //\n\nvar CTORS = {\n\t'int8': 'new Int8Array( [ {{data}} ] )',\n\t'uint8': 'new Uint8Array( [ {{data}} ] )',\n\t'uint8c': 'new Uint8ClampedArray( [ {{data}} ] )',\n\t'int16': 'new Int16Array( [ {{data}} ] )',\n\t'uint16': 'new Uint16Array( [ {{data}} ] )',\n\t'int32': 'new Int32Array( [ {{data}} ] )',\n\t'uint32': 'new Uint32Array( [ {{data}} ] )',\n\t'float32': 'new Float32Array( [ {{data}} ] )',\n\t'float64': 'new Float64Array( [ {{data}} ] )',\n\t'generic': '[ {{data}} ]',\n\t'binary': 'new Buffer( [ {{data}} ] )',\n\t'complex64': 'new Complex64Array( [ {{data}} ] )',\n\t'complex128': 'new Complex128Array( [ {{data}} ] )'\n};\n\n\n// MAIN //\n\n/**\n* Serializes an ndarray as a string.\n*\n* ## Notes\n*\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @private\n* @returns {string} string representation\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar buffer;\n\tvar ndims;\n\tvar ctor;\n\tvar str;\n\tvar dt;\n\tvar v;\n\tvar i;\n\n\tndims = this._shape.length;\n\tdt = this._dtype;\n\n\t// Function to invoke to create an ndarray:\n\tstr = 'ndarray( \\''+dt+'\\', ';\n\n\t// Data buffer parameter...\n\tbuffer = '';\n\tif ( this._length <= 100 ) {\n\t\tif ( dt === 'complex64' || dt === 'complex128' ) {\n\t\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\t\tv = this.iget( i );\n\t\t\t\tbuffer += real( v ) + ', ' + imag( v );\n\t\t\t\tif ( i < this._length-1 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\t\tbuffer += this.iget( i );\n\t\t\t\tif ( i < this._length-1 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// First three values...\n\t\tif ( dt === 'complex64' || dt === 'complex128' ) {\n\t\t\tfor ( i = 0; i < 3; i++ ) {\n\t\t\t\tv = this.iget( i );\n\t\t\t\tbuffer += real( v ) + ', ' + imag( v );\n\t\t\t\tif ( i < 2 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 0; i < 3; i++ ) {\n\t\t\t\tbuffer += this.iget( i );\n\t\t\t\tif ( i < 2 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbuffer += ', ..., ';\n\n\t\t// Last three values...\n\t\tif ( dt === 'complex64' || dt === 'complex128' ) {\n\t\t\tfor ( i = 2; i >= 0; i-- ) {\n\t\t\t\tv = this.iget( this._length-1-i );\n\t\t\t\tbuffer += real( v ) + ', ' + imag( v );\n\t\t\t\tif ( i > 0 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i = 2; i >= 0; i-- ) {\n\t\t\t\tbuffer += this.iget( this._length-1-i );\n\t\t\t\tif ( i > 0 ) {\n\t\t\t\t\tbuffer += ', ';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tctor = CTORS[ this.dtype ];\n\tstr += replace( ctor, '{{data}}', buffer );\n\tstr += ', ';\n\n\t// Array shape...\n\tif ( ndims === 0 ) {\n\t\tstr += '[]';\n\t} else {\n\t\tstr += '[ ' + this._shape.join( ', ' ) + ' ]';\n\t}\n\tstr += ', ';\n\n\t// Stride array...\n\tstr += '[ ';\n\tif ( ndims === 0 ) {\n\t\tstr += '0';\n\t} else {\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\tif ( this._strides[ i ] < 0 ) {\n\t\t\t\tstr += -this._strides[ i ];\n\t\t\t} else {\n\t\t\t\tstr += this._strides[ i ];\n\t\t\t}\n\t\t\tif ( i < ndims-1 ) {\n\t\t\t\tstr += ', ';\n\t\t\t}\n\t\t}\n\t}\n\tstr += ' ]';\n\tstr += ', ';\n\n\t// Buffer offset:\n\tstr += '0';\n\tstr += ', ';\n\n\t// Order:\n\tstr += '\\'' + this._order + '\\'';\n\n\t// Close the function call:\n\tstr += ' )';\n\treturn str;\n\n\t/* eslint-enable no-invalid-this */\n}\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 Uint8Array from '@stdlib/array-uint8';\nimport Uint16Array from '@stdlib/array-uint16';\n\n\n// MAIN //\n\nvar ctors = {\n\t'uint16': Uint16Array,\n\t'uint8': Uint8Array\n};\n\n\n// EXPORTS //\n\nexport default ctors;\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 ctors from './ctors.js';\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if an environment is little endian.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment is little endian\n*\n* @example\n* var bool = isLittleEndian();\n* // returns \n*/\nfunction isLittleEndian() {\n\tvar uint16view;\n\tvar uint8view;\n\n\tuint16view = new ctors[ 'uint16' ]( 1 );\n\n\t/*\n\t* Set the uint16 view to a value having distinguishable lower and higher order words.\n\t*\n\t* 4660 => 0x1234 => 0x12 0x34 => '00010010 00110100' => (0x12,0x34) == (18,52)\n\t*/\n\tuint16view[ 0 ] = 0x1234;\n\n\t// Create a uint8 view on top of the uint16 buffer:\n\tuint8view = new ctors[ 'uint8' ]( uint16view.buffer );\n\n\t// If little endian, the least significant byte will be first...\n\treturn ( uint8view[ 0 ] === 0x34 );\n}\n\n\n// MAIN //\n\nbool = isLittleEndian();\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// MAIN //\n\nvar main = ( typeof ArrayBuffer === 'function' ) ? ArrayBuffer : null; // eslint-disable-line stdlib/require-globals\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 ctor = ( typeof ArrayBuffer === 'function' ) ? ArrayBuffer : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Constructor which returns an object used to represent a generic, fixed-length raw binary data buffer.\n*\n* @module @stdlib/array-buffer\n*\n* @example\n* import ctor from '@stdlib/array-buffer';\n*\n* var buf = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasArrayBufferSupport from '@stdlib/assert-has-arraybuffer-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasArrayBufferSupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isArrayBuffer from '@stdlib/assert-is-arraybuffer';\nimport Float64Array from '@stdlib/array-float64';\nimport GlobalArrayBuffer from './arraybuffer.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `ArrayBuffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `ArrayBuffer` support\n*\n* @example\n* var bool = hasArrayBufferSupport();\n* // returns \n*/\nfunction hasArrayBufferSupport() {\n\tvar bool;\n\tvar view;\n\tvar buf;\n\n\tif ( typeof GlobalArrayBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tbuf = new GlobalArrayBuffer( 16 );\n\t\tbool = ( isArrayBuffer( buf ) && typeof GlobalArrayBuffer.isView === 'function' );\n\t\tif ( bool ) {\n\t\t\tview = new Float64Array( buf );\n\t\t\tview[ 0 ] = -3.14;\n\t\t\tview[ 1 ] = NaN;\n\t\t\tbool = (\n\t\t\t\tbool &&\n\t\t\t\tGlobalArrayBuffer.isView( view ) &&\n\t\t\t\tbuf.byteLength === 16 &&\n\t\t\t\tview[ 0 ] === -3.14 &&\n\t\t\t\tview[ 1 ] !== view[ 1 ]\n\t\t\t);\n\t\t}\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasArrayBufferSupport;\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: write polyfill\n\n// MAIN //\n\n/**\n* Constructor which returns an object used to represent a generic, fixed-length raw binary data buffer.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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 nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar hasDataView = ( typeof DataView === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `DataView`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a DataView\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* import DataView from '@stdlib/array-dataview';\n*\n* var bool = isDataView( new DataView( new ArrayBuffer( 10 ) ) );\n* // returns true\n*\n* @example\n* var bool = isDataView( [] );\n* // returns false\n*/\nfunction isDataView( value ) {\n\treturn (\n\t\t( hasDataView && value instanceof DataView ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object DataView]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isDataView;\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\nvar main = ( typeof DataView === 'function' ) ? DataView : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default main;\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\nvar ctor = ( typeof DataView === 'function' ) ? DataView : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\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* Constructor which returns a data view representing a provided array buffer.\n*\n* @module @stdlib/array-dataview\n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n* import DataView from '@stdlib/array-dataview';\n*\n* var buf = new ArrayBuffer( 10 );\n* // returns \n*\n* var dv = new DataView( buf );\n* // returns \n*/\n\n// MODULES //\n\nimport hasDataViewSupport from '@stdlib/assert-has-dataview-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasDataViewSupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ctor;\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 isDataView from '@stdlib/assert-is-dataview';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport GlobalDataView from './dataview.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `DataView` support.\n*\n* @returns {boolean} boolean indicating if an environment has `DataView` support\n*\n* @example\n* var bool = hasDataViewSupport();\n* // returns \n*/\nfunction hasDataViewSupport() {\n\tvar bool;\n\tvar view;\n\tvar buf;\n\n\tif ( typeof GlobalDataView !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tbuf = new ArrayBuffer( 24 );\n\t\tview = new GlobalDataView( buf, 8 );\n\t\tbool = ( isDataView( view ) && typeof view.getFloat64 === 'function' && typeof view.setFloat64 === 'function' );\n\t\tif ( bool ) {\n\t\t\tview.setFloat64( 0, -3.14 );\n\t\t\tview.setFloat64( 8, NaN );\n\t\t\tbool = (\n\t\t\t\tbool &&\n\t\t\t\tview.buffer === buf &&\n\t\t\t\tview.byteLength === 16 &&\n\t\t\t\tview.byteOffset === 8 &&\n\t\t\t\tview.getFloat64( 0 ) === -3.14 &&\n\t\t\t\tview.getFloat64( 8 ) !== view.getFloat64( 8 )\n\t\t\t);\n\t\t}\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nexport default hasDataViewSupport;\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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Constructor which returns a data view representing a provided array buffer.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nexport default polyfill;\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/* global BigInt */\n\n'use strict';\n\n// MAIN //\n\nvar BigInteger = ( typeof BigInt === 'function' ) ? BigInt : void 0; // eslint-disable-line stdlib/require-globals, node/no-unsupported-features/es-builtins\n\n\n// EXPORTS //\n\nexport default BigInteger;\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 MODES from './modes.json';\n\n\n// MAIN //\n\n/**\n* Returns a list of ndarray index modes.\n*\n* @returns {StringArray} list of ndarray index modes\n*\n* @example\n* var list = modes();\n* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]\n*/\nfunction modes() {\n\treturn MODES.slice();\n}\n\n\n// EXPORTS //\n\nexport default modes;\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 an object mapping supported index modes 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., `throw == 1`). Instead, the object should be used in an opaque manner.\n* - The main purpose of this function is JavaScript and C inter-operation of ndarray objects.\n*\n* @returns {Object} object mapping supported index modes to integer values\n*\n* @example\n* var table = enumerated();\n* // returns \n*/\nfunction enumerated() {\n\t// NOTE: the following should match the C `index_modes.h` enumeration!!!!\n\treturn {\n\t\t'throw': 1,\n\t\t'clamp': 2,\n\t\t'wrap': 3,\n\t\t'normalize': 4\n\t};\n}\n\n\n// EXPORTS //\n\nexport default enumerated;\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 list of ndarray index modes.\n*\n* @module @stdlib/ndarray-index-modes\n*\n* @example\n* import modes from '@stdlib/ndarray-index-modes';\n*\n* var list = modes();\n* // returns [ 'throw', 'normalize', 'clamp', 'wrap' ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport modes from './main.js';\nimport enumeration from './enum.js';\n\n\n// MAIN //\n\nsetReadOnly( modes, 'enum', enumeration );\n\n\n// EXPORTS //\n\nexport default modes;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport DataView from '@stdlib/array-dataview';\nimport BigInt from '@stdlib/bigint-ctor';\nimport { enum as dtypes } from '@stdlib/ndarray-dtypes';\nimport { enum as orders } from '@stdlib/ndarray-orders';\nimport { enum as modes } from '@stdlib/ndarray-index-modes';\n\n\n// VARIABLES //\n\nvar DTYPES = dtypes();\nvar ORDERS = orders();\nvar MODES = modes();\n\n\n// FUNCTIONS //\n\n/**\n* Serializes ndarray meta data to a `DataView`.\n*\n* ## Notes\n*\n* - This function takes into account ndarray-like objects which may support index modes.\n*\n* - This function defaults to returning cached serialized meta data. To force serialization, set the private `__meta_dataview__` property to `null`.\n*\n* - Serialization is performed according to host byte order (endianness).\n*\n* - Meta data format:\n*\n* ```text\n* | endianness (1 byte) | (2 bytes) | (8 bytes) | (ndims*8 bytes) | (ndims*8 bytes) | (8 bytes) | (1 byte) | (1 byte) | (8 bytes) | (nsubmodes*1 bytes) | (4 bytes) |\n* ```\n*\n* which translates to the following `ArrayBuffer` layout:\n*\n* ```text\n* ArrayBuffer[\n* [int8],\n* [int16],\n* [int64],\n* [ndims*int64],\n* [ndims*int64],\n* [int64],\n* [int8],\n* [int8],\n* [int64],\n* [nsubmodes*int8],\n* [int32]\n* ]\n* ```\n*\n* where `strides` and `offset` are in units of bytes.\n*\n* - If the endianness is `1`, the byte order is little endian. If the endianness is `0`, the byte order is big endian.\n*\n* - Buffer length:\n*\n* ```text\n* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) + 4 = 33 + (ndims*16) + nsubmodes\n* ```\n*\n* For example, consider a three-dimensional ndarray with one subscript index mode (submode):\n*\n* ```text\n* 33 + (3*16) + 1 = 82 bytes\n* ```\n*\n* - Views:\n*\n* - endianness: `Int8Array( buf, 0, 1 )`\n* - dtype: `Int16Array( buf, 1, 1 )`\n* - ndims: `Int64Array( buf, 3, 1 )`\n* - shape: `Int64Array( buf, 11, ndims )`\n* - strides: `Int64Array( buf, 11+(ndims*8), ndims )`\n* - offset: `Int64Array( buf, 11+(ndims*16), 1 )`\n* - order: `Int8Array( buf, 19+(ndims*16), 1 )`\n* - mode: `Int8Array( buf, 20+(ndims*16), 1 )`\n* - nsubmodes: `Int64Array( buf, 21+(ndims*16), 1 )`\n* - submodes: `Int8Array( buf, 29+(ndims*16), nsubmodes )`\n* - flags: `Int32Array( buf, 29+(ndims*16)+nsubmodes, 1 )`\n*\n* @private\n* @returns {DataView} serialized meta data\n*/\nfunction meta2dataview() {\n\t/* eslint-disable no-invalid-this */\n\tvar nbytes;\n\tvar flgs;\n\tvar len;\n\tvar dt;\n\tvar sh;\n\tvar st;\n\tvar sm;\n\tvar v;\n\tvar m;\n\tvar o;\n\tvar s;\n\tvar N;\n\tvar M;\n\tvar i;\n\n\tm = this._mode || 'throw';\n\tsm = this._submode || [ m ];\n\tN = this._ndims;\n\tM = sm.length;\n\n\t// Compute the amount of memory we need to allocate for storing meta data:\n\tlen = 33 + (N*16) + M;\n\n\t// Check if we've already serialized ndarray meta data and can reuse an already allocated array buffer...\n\tv = this.__meta_dataview__;\n\tif ( v && v.byteLength === len ) { // Note: the byte length check is only a bare minimum sanity check, as cached contents may still be \"stale\" (e.g., shape and/or strides may have changed)\n\t\treturn v;\n\t}\n\t// Allocate raw memory and create a view for interfacing with the allocated memory:\n\tv = new DataView( new ArrayBuffer( len ) );\n\n\t// Retrieve ndarray meta data:\n\tsh = this._shape;\n\tst = this._strides;\n\tdt = this._dtype;\n\tnbytes = this._bytesPerElement;\n\n\t// Endianness: (byteoffset: 0; bytelength: 1)\n\to = 0;\n\tv.setInt8( o, ( IS_LITTLE_ENDIAN ) ? 1 : 0 );\n\n\t// Data type: (byteoffset: 1; bytelength: 2)\n\to += 1;\n\tv.setInt16( o, DTYPES[ dt ], IS_LITTLE_ENDIAN );\n\n\t// Number of dimensions: (byteoffset: 3; bytelength: 8)\n\to += 2;\n\tv.setBigInt64( o, BigInt( N ), IS_LITTLE_ENDIAN );\n\n\t// Shape and strides: (byteoffset: 11 and 11+(ndims*8), respectively; bytelength: ndims*8 for both shape and strides, and, thus, ndims*16 total)\n\ts = N * 8; // stride length between a dimension (shape[i]) and its associated stride\n\to += 8;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tv.setBigInt64( o, BigInt( sh[i] ), IS_LITTLE_ENDIAN );\n\t\tv.setBigInt64( o+s, BigInt( st[i]*nbytes ), IS_LITTLE_ENDIAN );\n\t\to += 8;\n\t}\n\t// Offset: (byteoffset: 11+(ndims*16); bytelength: 8)\n\to += s;\n\tv.setBigInt64( o, BigInt( this._offset*nbytes ), IS_LITTLE_ENDIAN );\n\n\t// Order: (byteoffset: 19+(ndims*16); bytelength: 1)\n\to += 8;\n\tv.setInt8( o, ORDERS[ this._order ] );\n\n\t// Mode: (byteoffset: 20+(ndims*16); bytelength: 1)\n\to += 1;\n\tv.setInt8( o, MODES[ m ] );\n\n\t// Number of submodes: (byteoffset: 21+(ndims*16); bytelength: 8)\n\to += 1;\n\tv.setBigInt64( o, BigInt( M ), IS_LITTLE_ENDIAN );\n\n\t// Submodes: (byteoffset: 29+(ndims*16); bytelength: nsubmodes*1)\n\to += 8;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tv.setInt8( o, MODES[ sm[i] ] );\n\t\to += 1;\n\t}\n\t// Flags: (byteoffset: 29+(ndims*16)+nsubmodes; bytelength: 4)\n\tflgs = 0|0;\n\tflgs |= ( this._flags.READONLY ) ? 4 : 0; // 00000000 00000000 00000000 00000100\n\tv.setInt32( o, flgs, IS_LITTLE_ENDIAN );\n\n\t// Cache the serialized meta data:\n\tthis.__meta_dataview__ = v;\n\n\treturn v;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// EXPORTS //\n\nexport default meta2dataview;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport Uint8Array from '@stdlib/array-uint8';\nimport DataView from '@stdlib/array-dataview';\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// VARIABLES //\n\n// 0xFFFFFFFF = 2**32 - 1 => 11111111 11111111 11111111 11111111\nvar LOW_MASK = 0xFFFFFFFF >>> 0;\n\n// 2**32\nvar TWO_32 = 4294967296;\n\n// Byte array workspace:\nvar BYTES = new Uint8Array( 8 );\nvar VIEW = new DataView( BYTES.buffer );\n\n\n// MAIN //\n\n/**\n* Converts an integer-valued double-precision floating-point number to a signed 64-bit integer byte array according to host byte order (endianness).\n*\n* ## Notes\n*\n* - This function assumes that the input value is less than the maximum safe double-precision floating-point integer plus one (i.e., `2**53`).\n*\n* @param {number} x - input value\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n*\n* var out = new Uint8Array( 8 );\n* var bytes = float64ToInt64Bytes( 1.0, out, 1, 0 );\n* // returns \n*/\nfunction float64ToInt64Bytes( x, out, stride, offset ) {\n\tvar hi;\n\tvar lo;\n\tvar i;\n\n\tif ( x === 0 ) {\n\t\tfor ( i = 0; i < BYTES.length; i++ ) {\n\t\t\tout[ offset ] = 0;\n\t\t\toffset += stride;\n\t\t}\n\t\treturn out;\n\t}\n\t// Get the low 32-bit word:\n\tlo = (x&LOW_MASK)>>>0;\n\n\t// Get the high 32-bit word:\n\thi = floor( x/TWO_32 );\n\n\t// Insert the high and low words according to host byte order (endianness):\n\tif ( IS_LITTLE_ENDIAN ) {\n\t\tVIEW.setUint32( 0, lo, IS_LITTLE_ENDIAN );\n\t\tVIEW.setUint32( 4, hi, IS_LITTLE_ENDIAN );\n\t} else {\n\t\tVIEW.setUint32( 0, hi, IS_LITTLE_ENDIAN );\n\t\tVIEW.setUint32( 4, lo, IS_LITTLE_ENDIAN );\n\t}\n\tfor ( i = 0; i < BYTES.length; i++ ) {\n\t\tout[ offset ] = BYTES[ i ];\n\t\toffset += stride;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default float64ToInt64Bytes;\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* Convert an integer-valued double-precision floating-point number to a signed 64-bit integer byte array according to host byte order (endianness).\n*\n* @module @stdlib/number-float64-base-to-int64-bytes\n*\n* @example\n* import float64ToInt64Bytes from '@stdlib/number-float64-base-to-int64-bytes';\n*\n* var bytes = float64ToInt64Bytes( 1.0 );\n* // returns \n*\n* @example\n* import Uint8Array from '@stdlib/array-uint8';\n* import float64ToInt64Bytes from '@stdlib/number-float64-base-to-int64-bytes';\n*\n* var out = new Uint8Array( 8 );\n* var bytes = float64ToInt64Bytes( 1.0, out, 1, 0 );\n* // returns \n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport Uint8Array from '@stdlib/array-uint8';\nimport DataView from '@stdlib/array-dataview';\nimport floor from '@stdlib/math-base-special-floor';\n\n\n// VARIABLES //\n\n// 0xFFFFFFFF = 2**32 - 1 => 11111111 11111111 11111111 11111111\nvar LOW_MASK = 0xFFFFFFFF >>> 0;\n\n// 2**32\nvar TWO_32 = 4294967296;\n\n\n// MAIN //\n\n/**\n* Converts an integer-valued double-precision floating-point number to a signed 64-bit integer byte array according to host byte order (endianness).\n*\n* ## Notes\n*\n* - This function assumes that the input value is less than the maximum safe double-precision floating-point integer plus one (i.e., `2**53`).\n*\n* @param {number} x - input value\n* @returns {Uint8Array} byte array\n*\n* @example\n* var bytes = float64ToInt64Bytes( 1.0 );\n* // returns \n*/\nfunction float64ToInt64Bytes( x ) {\n\tvar bytes;\n\tvar view;\n\tvar hi;\n\tvar lo;\n\n\tbytes = new Uint8Array( 8 );\n\tif ( x === 0 ) {\n\t\treturn bytes;\n\t}\n\t// Get the low 32-bit word:\n\tlo = (x&LOW_MASK)>>>0;\n\n\t// Get the high 32-bit word:\n\thi = floor( x/TWO_32 );\n\n\t// Insert the high and low words according to host byte order (endianness):\n\tview = new DataView( bytes.buffer );\n\tif ( IS_LITTLE_ENDIAN ) {\n\t\tview.setUint32( 0, lo, IS_LITTLE_ENDIAN );\n\t\tview.setUint32( 4, hi, IS_LITTLE_ENDIAN );\n\t} else {\n\t\tview.setUint32( 0, hi, IS_LITTLE_ENDIAN );\n\t\tview.setUint32( 4, lo, IS_LITTLE_ENDIAN );\n\t}\n\treturn bytes;\n}\n\n\n// EXPORTS //\n\nexport default float64ToInt64Bytes;\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 IS_LITTLE_ENDIAN from '@stdlib/assert-is-little-endian';\nimport ArrayBuffer from '@stdlib/array-buffer';\nimport DataView from '@stdlib/array-dataview';\nimport Uint8Array from '@stdlib/array-uint8';\nimport { enum as dtypes } from '@stdlib/ndarray-dtypes';\nimport { enum as orders } from '@stdlib/ndarray-orders';\nimport { enum as modes } from '@stdlib/ndarray-index-modes';\nimport { assign as float64ToInt64Bytes } from '@stdlib/number-float64-base-to-int64-bytes';\n\n\n// VARIABLES //\n\nvar DTYPES = dtypes();\nvar ORDERS = orders();\nvar MODES = modes();\n\n\n// FUNCTIONS //\n\n/**\n* Serializes ndarray meta data to a `DataView`.\n*\n* ## Notes\n*\n* - This function takes into account ndarray-like objects which may support index modes.\n*\n* - This function defaults to returning cached serialized meta data. To force serialization, set the private `__meta_dataview__` property to `null`.\n*\n* - Serialization is performed according to host byte order (endianness).\n*\n* - Meta data format:\n*\n* ```text\n* | endianness (1 byte) | (2 bytes) | (8 bytes) | (ndims*8 bytes) | (ndims*8 bytes) | (8 bytes) | (1 byte) | (1 byte) | (8 bytes) | (nsubmodes*1 bytes) | (4 bytes) |\n* ```\n*\n* which translates to the following `ArrayBuffer` layout:\n*\n* ```text\n* ArrayBuffer[\n* [int8],\n* [int16],\n* [int64],\n* [ndims*int64],\n* [ndims*int64],\n* [int64],\n* [int8],\n* [int8],\n* [int64],\n* [nsubmodes*int8],\n* [int32]\n* ]\n* ```\n*\n* where `strides` and `offset` are in units of bytes.\n*\n* - If the endianness is `1`, the byte order is little endian. If the endianness is `0`, the byte order is big endian.\n*\n* - Buffer length:\n*\n* ```text\n* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) + 4 = 33 + (ndims*16) + nsubmodes\n* ```\n*\n* For example, consider a three-dimensional ndarray with one subscript index mode (submode):\n*\n* ```text\n* 33 + (3*16) + 1 = 82 bytes\n* ```\n*\n* - Views:\n*\n* - endianness: `Int8Array( buf, 0, 1 )`\n* - dtype: `Int16Array( buf, 1, 1 )`\n* - ndims: `Int64Array( buf, 3, 1 )`\n* - shape: `Int64Array( buf, 11, ndims )`\n* - strides: `Int64Array( buf, 11+(ndims*8), ndims )`\n* - offset: `Int64Array( buf, 11+(ndims*16), 1 )`\n* - order: `Int8Array( buf, 19+(ndims*16), 1 )`\n* - mode: `Int8Array( buf, 20+(ndims*16), 1 )`\n* - nsubmodes: `Int64Array( buf, 21+(ndims*16), 1 )`\n* - submodes: `Int8Array( buf, 29+(ndims*16), nsubmodes )`\n* - flags: `Int32Array( buf, 29+(ndims*16)+nsubmodes, 1 )`\n*\n* @private\n* @returns {DataView} serialized meta data\n*/\nfunction meta2dataview() {\n\t/* eslint-disable no-invalid-this */\n\tvar nbytes;\n\tvar bytes;\n\tvar flgs;\n\tvar len;\n\tvar dt;\n\tvar sh;\n\tvar st;\n\tvar sm;\n\tvar v;\n\tvar m;\n\tvar o;\n\tvar s;\n\tvar N;\n\tvar M;\n\tvar i;\n\n\tm = this._mode || 'throw';\n\tsm = this._submode || [ m ];\n\tN = this._ndims;\n\tM = sm.length;\n\n\t// Compute the amount of memory we need to allocate for storing meta data:\n\tlen = 33 + (N*16) + M;\n\n\t// Check if we've already serialized ndarray meta data and can reuse an already allocated array buffer...\n\tv = this.__meta_dataview__;\n\tif ( v && v.byteLength === len ) { // Note: the byte length check is only a bare minimum sanity check, as cached contents may still be \"stale\" (e.g., shape and/or strides may have changed)\n\t\treturn v;\n\t}\n\t// Allocate raw memory and create views for interfacing with the allocated memory:\n\tv = new DataView( new ArrayBuffer( len ) );\n\tbytes = new Uint8Array( v.buffer );\n\n\t// Retrieve ndarray meta data:\n\tsh = this._shape;\n\tst = this._strides;\n\tdt = this._dtype;\n\tnbytes = this._bytesPerElement;\n\n\t// Endianness: (byteoffset: 0; bytelength: 1)\n\to = 0;\n\tv.setInt8( o, ( IS_LITTLE_ENDIAN ) ? 1 : 0 );\n\n\t// Data type: (byteoffset: 1; bytelength: 2)\n\to += 1;\n\tv.setInt16( o, DTYPES[ dt ], IS_LITTLE_ENDIAN );\n\n\t// Number of dimensions: (byteoffset: 3; bytelength: 8)\n\to += 2;\n\tfloat64ToInt64Bytes( N, bytes, 1, o );\n\n\t// Shape and strides: (byteoffset: 11 and 11+(ndims*8), respectively; bytelength: ndims*8 for both shape and strides, and, thus, ndims*16 total)\n\ts = N * 8; // stride length between a dimension (shape[i]) and its associated stride\n\to += 8;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tfloat64ToInt64Bytes( sh[i], bytes, 1, o );\n\t\tfloat64ToInt64Bytes( st[i]*nbytes, bytes, 1, o+s );\n\t\to += 8;\n\t}\n\t// Offset: (byteoffset: 11+(ndims*16); bytelength: 8)\n\to += s;\n\tfloat64ToInt64Bytes( this._offset*nbytes, bytes, 1, o );\n\n\t// Order: (byteoffset: 19+(ndims*16); bytelength: 1)\n\to += 8;\n\tv.setInt8( o, ORDERS[ this._order ] );\n\n\t// Mode: (byteoffset: 20+(ndims*16); bytelength: 1)\n\to += 1;\n\tv.setInt8( o, MODES[ m ] );\n\n\t// Number of submodes: (byteoffset: 21+(ndims*16); bytelength: 8)\n\to += 1;\n\tfloat64ToInt64Bytes( M, bytes, 1, o );\n\n\t// Submodes: (byteoffset: 29+(ndims*16); bytelength: nsubmodes*1)\n\to += 8;\n\tfor ( i = 0; i < M; i++ ) {\n\t\tv.setInt8( o, MODES[ sm[i] ] );\n\t\to += 1;\n\t}\n\t// Flags: (byteoffset: 29+(ndims*16)+nsubmodes; bytelength: 4)\n\tflgs = 0|0;\n\tflgs |= ( this._flags.READONLY ) ? 4 : 0; // 00000000 00000000 00000000 00000100\n\tv.setInt32( o, flgs, IS_LITTLE_ENDIAN );\n\n\t// Cache the serialized meta data:\n\tthis.__meta_dataview__ = v;\n\n\treturn v;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// EXPORTS //\n\nexport default meta2dataview;\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-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport hasBigIntSupport from '@stdlib/assert-has-bigint-support';\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils-define-nonenumerable-read-only-accessor';\nimport bytesPerElement from '@stdlib/ndarray-base-bytes-per-element';\nimport iterationOrder from '@stdlib/ndarray-base-iteration-order';\nimport strides2order from '@stdlib/ndarray-base-strides2order';\nimport Boolean from '@stdlib/boolean-ctor';\nimport isColumnMajorContiguous from './is_column_major_contiguous.js';\nimport isRowMajorContiguous from './is_row_major_contiguous.js';\nimport isContiguous from './is_contiguous.js';\nimport copyFlags from './copy_flags.js';\nimport igetValue from './iget.js';\nimport isetValue from './iset.js';\nimport setValue from './set.js';\nimport getValue from './get.js';\nimport toJSON from './tojson.js';\nimport toString from './tostring.js'; // eslint-disable-line stdlib/no-redeclare\nimport meta2dataview from './meta2dataview.js';\nimport meta2dataviewPolyfill from './meta2dataview.polyfill.js';\n\n\n// MAIN //\n\n/**\n* ndarray constructor.\n*\n* ## Notes\n*\n* - To create a zero-dimensional array,\n*\n* ```javascript\n* var buffer = [ 1 ];\n* var shape = [];\n* var strides = [ 0 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n* ```\n*\n* @constructor\n* @param {string} dtype - data type\n* @param {(ArrayLikeObject|TypedArray|Buffer)} buffer - data buffer\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - array strides\n* @param {NonNegativeInteger} offset - index offset\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*/\nfunction ndarray( dtype, buffer, shape, strides, offset, order ) {\n\tvar contiguous;\n\tvar nbytes;\n\tvar ord;\n\tvar len;\n\tvar i;\n\tif ( !(this instanceof ndarray) ) {\n\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order );\n\t}\n\t// Compute the number of elements...\n\tlen = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tlen *= shape[ i ];\n\t}\n\t// Compute the number of bytes...\n\tif ( buffer.BYTES_PER_ELEMENT ) {\n\t\tnbytes = buffer.BYTES_PER_ELEMENT * len;\n\t} else {\n\t\tnbytes = null;\n\t}\n\t// Set private properties...\n\tthis._byteLength = nbytes;\n\tthis._bytesPerElement = bytesPerElement( dtype );\n\tthis._buffer = buffer;\n\tthis._dtype = dtype;\n\tthis._length = len;\n\tthis._ndims = shape.length;\n\tthis._offset = offset;\n\tthis._order = order;\n\tthis._shape = shape;\n\tthis._strides = strides;\n\tthis._accessors = Boolean( buffer.get && buffer.set );\n\n\tthis._iterationOrder = iterationOrder( strides );\n\n\t// Determine if the array can be stored contiguously:\n\tcontiguous = isContiguous( len, shape, strides, offset, this._iterationOrder ); // eslint-disable-line max-len\n\n\t// Infer the array \"order\" from the stride array (this is supplementary to the `order` parameter):\n\tord = strides2order( strides );\n\n\tthis._flags = {\n\t\t'ROW_MAJOR_CONTIGUOUS': isRowMajorContiguous( ord, contiguous ),\n\t\t'COLUMN_MAJOR_CONTIGUOUS': isColumnMajorContiguous( ord, contiguous ),\n\t\t'READONLY': false\n\t};\n\n\t// Initialize a property for caching serialized meta data:\n\tthis.__meta_dataview__ = null;\n\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof ndarray\n* @type {string}\n* @default 'ndarray'\n*\n* @example\n* var str = ndarray.name;\n* // returns 'ndarray'\n*/\nsetReadOnly( ndarray, 'name', 'ndarray' );\n\n/**\n* Size (in bytes) of the array (if known).\n*\n* @name byteLength\n* @memberof ndarray.prototype\n* @type {(NonNegativeInteger|null)}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var buffer = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] );\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );\n*\n* var byteLength = x.byteLength;\n* // returns 48\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'byteLength', function get() {\n\treturn this._byteLength;\n});\n\n/**\n* Size (in bytes) of each array element (if known).\n*\n* @name BYTES_PER_ELEMENT\n* @memberof ndarray.prototype\n* @type {(PositiveInteger|null)}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* var buffer = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] );\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );\n*\n* var nbytes = x.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'BYTES_PER_ELEMENT', function get() {\n\treturn this._bytesPerElement;\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name data\n* @memberof ndarray.prototype\n* @type {(Array|TypedArray|Buffer)}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var data = x.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'data', function get() {\n\treturn this._buffer;\n});\n\n/**\n* Underlying data type.\n*\n* @name dtype\n* @memberof ndarray.prototype\n* @type {string}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var dtype = x.dtype;\n* // returns 'generic'\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'dtype', function get() {\n\treturn this._dtype;\n});\n\n/**\n* Meta information, such as information concerning the memory layout of the array.\n*\n* @name flags\n* @memberof ndarray.prototype\n* @type {Object}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var flgs = x.flags;\n* // returns \n*/\nsetReadOnlyAccessor( ndarray.prototype, 'flags', function get() {\n\treturn copyFlags( this._flags );\n});\n\n/**\n* Length of the array.\n*\n* @name length\n* @memberof ndarray.prototype\n* @type {NonNegativeInteger}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var len = x.length;\n* // returns 6\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Number of dimensions.\n*\n* @name ndims\n* @memberof ndarray.prototype\n* @type {PositiveInteger}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var ndims = x.ndims;\n* // returns 2\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'ndims', function get() {\n\treturn this._ndims;\n});\n\n/**\n* Index offset which specifies the buffer index at which to start iterating over array elements.\n*\n* @name offset\n* @memberof ndarray.prototype\n* @type {NonNegativeInteger}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var o = x.offset;\n* // returns 0\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'offset', function get() {\n\treturn this._offset;\n});\n\n/**\n* Array order.\n*\n* ## Notes\n*\n* - The array order is either row-major (C-style) or column-major (Fortran-style).\n*\n* @name order\n* @memberof ndarray.prototype\n* @type {string}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var order = x.order;\n* // returns 'row-major'\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'order', function get() {\n\treturn this._order;\n});\n\n/**\n* Shape of the array.\n*\n* @name shape\n* @memberof ndarray.prototype\n* @type {NonNegativeIntegerArray}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var s = x.shape;\n* // returns [ 3, 2 ]\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'shape', function get() {\n\treturn this._shape.slice();\n});\n\n/**\n* Index strides which specify how to access data along corresponding array dimensions.\n*\n* @name strides\n* @memberof ndarray.prototype\n* @type {IntegerArray}\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var s = x.strides;\n* // returns [ 2, 1 ]\n*/\nsetReadOnlyAccessor( ndarray.prototype, 'strides', function get() {\n\treturn this._strides.slice();\n});\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name get\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'get', getValue );\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @name iget\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'iget', igetValue );\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name set\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*\n* x.set( 1, 1, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.get( 1, 1 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'set', setValue );\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @name iset\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*\n* x.iset( 3, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.iget( 3 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'iset', isetValue );\n\n/**\n* Serializes an ndarray as a string.\n*\n* ## Notes\n*\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @name toString\n* @memberof ndarray.prototype\n* @type {Function}\n* @returns {string} serialized ndarray\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var str = x.toString();\n* // returns \"ndarray( 'generic', [ 3, 4, 5, 6, 7, 8 ], [ 3, 2 ], [ 2, 1 ], 0, 'row-major' )\"\n*/\nsetReadOnly( ndarray.prototype, 'toString', toString );\n\n/**\n* Serializes an ndarray as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying an `ndarray` instance.\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @name toJSON\n* @memberof ndarray.prototype\n* @type {Function}\n* @returns {Object} serialized ndarray\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var o = x.toJSON();\n* // e.g., returns { 'type': 'ndarray', 'dtype': 'generic', 'flags': {...}, 'offset': 0, 'order': 'row-major', 'shape': [ 3, 2 ], 'strides': [ 2, 1 ], 'data': [ 3, 4, 5, 6, 7, 8 ] }\n*/\nsetReadOnly( ndarray.prototype, 'toJSON', toJSON );\n\n/**\n* Serializes ndarray meta data to a `DataView`.\n*\n* ## Notes\n*\n* - Meta data format:\n*\n* ```text\n* | (1 byte) | (2 bytes) | (8 bytes) | (ndims*8 bytes) | (ndims*8 bytes) | (8 bytes) | (1 byte) | (1 byte) | (8 bytes) | (nsubmodes*1 bytes) | (4 bytes) |\n* ```\n*\n* where `strides` and `offset` are in units of bytes.\n*\n* - If the endianness is `1`, the byte order is little endian. If the endianness is `0`, the byte order is big endian.\n*\n* - Serialization is performed according to host byte order (endianness).\n*\n* - Consumers of this method should treat the returned `DataView` as **immutable**. Otherwise, mutation can invalidate meta data and potentially affect other consumers.\n*\n* @private\n* @name __array_meta_dataview__\n* @memberof ndarray.prototype\n* @type {Function}\n* @returns {DataView} serialized meta data\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var dv = x.__array_meta_dataview__();\n* // returns \n*/\nsetReadOnly( ndarray.prototype, '__array_meta_dataview__', ( hasBigIntSupport() ) ? meta2dataview : meta2dataviewPolyfill );\n\n\n// EXPORTS //\n\nexport default ndarray;\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 BYTES_PER_ELEMENT from './bytes_per_element.json';\n\n\n// MAIN //\n\n/**\n* Returns the number of bytes per element provided an underlying array data type.\n*\n* @param {string} dtype - data type\n* @returns {(NonNegativeInteger|null)} number of bytes per element\n*\n* @example\n* var nbytes = bytesPerElement( 'float64' );\n* // returns 8\n*\n* nbytes = bytesPerElement( 'generic' );\n* // returns null\n*/\nfunction bytesPerElement( dtype ) {\n\treturn BYTES_PER_ELEMENT[ dtype ] || null;\n}\n\n\n// EXPORTS //\n\nexport default bytesPerElement;\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 array iteration order.\n*\n* ## Notes\n*\n* - Return value key:\n*\n* - `0`: unordered (i.e., strides of mixed sign; e.g., `[ 9, -3, 1 ]`)\n* - `1`: ordered left-to-right (i.e., all nonnegative strides)\n* - `-1`: ordered right-to-left (i.e., all negative strides)\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} iteration order\n*\n* @example\n* var o = iterationOrder( [ 2, 1 ] );\n* // returns 1\n*\n* o = iterationOrder( [ -2, 1 ] );\n* // returns 0\n*\n* o = iterationOrder( [ -2, -1 ] );\n* // returns -1\n*/\nfunction iterationOrder( strides ) {\n\tvar cnt;\n\tvar i;\n\n\tcnt = 0;\n\tfor ( i = 0; i < strides.length; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\tcnt += 1;\n\t\t}\n\t}\n\tif ( cnt === 0 ) {\n\t\t// All nonnegative strides:\n\t\treturn 1|0; // asm-type annotation\n\t}\n\tif ( cnt === strides.length ) {\n\t\t// All negative strides:\n\t\treturn -1|0; // asm-type annotation\n\t}\n\t// Strides of mixed signs:\n\treturn 0|0; // asm-type annotation\n}\n\n\n// EXPORTS //\n\nexport default iterationOrder;\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 minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\n\n\n// MAIN //\n\n/**\n* Determines if an array is contiguous.\n*\n* @private\n* @param {NonNegativeInteger} len - array length\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @param {integer} iterationOrder - iteration order\n* @returns {boolean} boolean indicating if an array is contiguous\n*/\nfunction isContiguous( len, shape, strides, offset, iterationOrder ) {\n\tvar buf;\n\n\t// If an array does not contain any elements, then no data to store, and, if the array is unordered, adjacent array elements are not guaranteed to be stored next to each other.\n\tif ( len === 0 || iterationOrder === 0 ) {\n\t\treturn false;\n\t}\n\t// Ensure that the array is compatible with a single memory segment:\n\tbuf = minmaxViewBufferIndex( shape, strides, offset );\n\treturn ( len === ( buf[1]-buf[0]+1 ) );\n}\n\n\n// EXPORTS //\n\nexport default isContiguous;\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 abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\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 default ndarray settings.\n*\n* @returns {Object} defaults\n*\n* @example\n* var o = defaults();\n* // returns {...}\n*/\nfunction defaults() {\n\treturn {\n\t\t// Data types:\n\t\t'dtypes': {\n\t\t\t'default': 'float64',\n\t\t\t'numeric': 'float64',\n\t\t\t'real': 'float64',\n\t\t\t'floating_point': 'float64',\n\t\t\t'real_floating_point': 'float64',\n\t\t\t'complex_floating_point': 'complex128',\n\t\t\t'integer': 'int32',\n\t\t\t'signed_integer': 'int32',\n\t\t\t'unsigned_integer': 'uint32',\n\t\t\t'boolean': 'bool'\n\t\t},\n\n\t\t// Memory layout:\n\t\t'order': 'row-major',\n\n\t\t// Casting mode:\n\t\t'casting': 'safe',\n\n\t\t// Index mode:\n\t\t'index_mode': 'throw'\n\t};\n}\n\n\n// EXPORTS //\n\nexport default defaults;\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* Copies ndarray flags.\n*\n* @private\n* @param {Object} flags - flags\n* @returns {Object} copy of input object\n*/\nfunction copyFlags( flags ) {\n\treturn {\n\t\t'ROW_MAJOR_CONTIGUOUS': flags.ROW_MAJOR_CONTIGUOUS,\n\t\t'COLUMN_MAJOR_CONTIGUOUS': flags.COLUMN_MAJOR_CONTIGUOUS,\n\t\t'READONLY': flags.READONLY\n\t};\n}\n\n\n// EXPORTS //\n\nexport default copyFlags;\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 an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} idx - indices\n* @returns {*} array element\n*/\nfunction get() {\n\t/* eslint-disable no-invalid-this */\n\tvar idx;\n\tvar i;\n\n\tidx = this._offset;\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\tidx += this._strides[ i ] * arguments[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( idx );\n\t}\n\treturn this._buffer[ idx ];\n}\n\n\n// EXPORTS //\n\nexport default get;\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 an array element located a specified linear view index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @returns {*} array element\n*/\nfunction iget( idx ) {\n\t/* eslint-disable no-invalid-this */\n\tvar strides;\n\tvar shape;\n\tvar ndims;\n\tvar ind;\n\tvar s;\n\tvar i;\n\n\tndims = this._ndims;\n\tif ( ndims === 0 ) {\n\t\tif ( this._accessors ) {\n\t\t\treturn this._buffer.get( this._offset );\n\t\t}\n\t\treturn this._buffer[ this._offset ];\n\t}\n\tif ( this._flags.ROW_MAJOR_CONTIGUOUS || this._flags.COLUMN_MAJOR_CONTIGUOUS ) { // eslint-disable-line max-len\n\t\t// Trivial case where we have all positive strides...\n\t\tif ( this._iterationOrder === 1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\treturn this._buffer.get( this._offset+idx );\n\t\t\t}\n\t\t\treturn this._buffer[ this._offset+idx ];\n\t\t}\n\t\t// Trivial case where we have all negative strides...\n\t\tif ( this._iterationOrder === -1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\treturn this._buffer.get( this.offset-idx );\n\t\t\t}\n\t\t\treturn this._buffer[ this._offset-idx ];\n\t\t}\n\t}\n\t// The approach which follows is to resolve a view index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the underlying data buffer...\n\tshape = this._shape;\n\tstrides = this._strides;\n\tind = this._offset;\n\tif ( this._order === 'column-major' ) {\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\ts = idx % shape[ i ];\n\t\t\tidx -= s;\n\t\t\tidx /= shape[ i ];\n\t\t\tind += s * strides[ i ];\n\t\t}\n\t\tif ( this._accessors ) {\n\t\t\treturn this._buffer.get( ind );\n\t\t}\n\t\treturn this._buffer[ ind ];\n\t}\n\t// Case: row-major\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\ts = idx % shape[ i ];\n\t\tidx -= s;\n\t\tidx /= shape[ i ];\n\t\tind += s * strides[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( ind );\n\t}\n\treturn this._buffer[ ind ];\n}\n\n\n// EXPORTS //\n\nexport default iget;\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* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*/\nfunction set() {\n\t/* eslint-disable no-invalid-this */\n\tvar idx;\n\tvar i;\n\n\tidx = this._offset;\n\tfor ( i = 0; i < arguments.length-1; i++ ) {\n\t\tidx += this._strides[ i ] * arguments[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( arguments[ i ], idx );\n\t} else {\n\t\tthis._buffer[ idx ] = arguments[ i ];\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default set;\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* Sets an array element located a specified linear view index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*/\nfunction iset( idx, v ) {\n\t/* eslint-disable no-invalid-this */\n\tvar strides;\n\tvar shape;\n\tvar ndims;\n\tvar ind;\n\tvar s;\n\tvar i;\n\n\tndims = this._ndims;\n\tif ( ndims === 0 ) {\n\t\tif ( this._accessors ) {\n\t\t\tthis._buffer.set( idx, this._offset );\n\t\t} else {\n\t\t\tthis._buffer[ this._offset ] = idx;\n\t\t}\n\t\treturn this;\n\t}\n\tif ( this._flags.ROW_MAJOR_CONTIGUOUS || this._flags.COLUMN_MAJOR_CONTIGUOUS ) { // eslint-disable-line max-len\n\t\t// Trivial case where we have all positive strides...\n\t\tif ( this._iterationOrder === 1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\tthis._buffer.set( v, this._offset+idx );\n\t\t\t} else {\n\t\t\t\tthis._buffer[ this._offset+idx ] = v;\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\t// Trivial case where we have all negative strides...\n\t\tif ( this._iterationOrder === -1 ) {\n\t\t\tif ( this._accessors ) {\n\t\t\t\tthis._buffer.set( v, this._offset-idx );\n\t\t\t} else {\n\t\t\t\tthis._buffer[ this._offset-idx ] = v;\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t}\n\t// The approach which follows is to resolve a view index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the underlying data buffer...\n\tshape = this._shape;\n\tstrides = this._strides;\n\tind = this._offset;\n\tif ( this._order === 'column-major' ) {\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\ts = idx % shape[ i ];\n\t\t\tidx -= s;\n\t\t\tidx /= shape[ i ];\n\t\t\tind += s * strides[ i ];\n\t\t}\n\t\tif ( this._accessors ) {\n\t\t\tthis._buffer.set( v, ind );\n\t\t} else {\n\t\t\tthis._buffer[ ind ] = v;\n\t\t}\n\t\treturn this;\n\t}\n\t// Case: row-major\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\ts = idx % shape[ i ];\n\t\tidx -= s;\n\t\tidx /= shape[ i ];\n\t\tind += s * strides[ i ];\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( v, ind );\n\t} else {\n\t\tthis._buffer[ ind ] = v;\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default iset;\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 real from '@stdlib/complex-float64-real';\nimport imag from '@stdlib/complex-float64-imag';\n\n\n// MAIN //\n\n/**\n* Serializes an ndarray as a JSON object.\n*\n* ## Notes\n*\n* - The method does **not** serialize data outside of the buffer region defined by the array configuration.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tlen = this._length;\n\n\t// Build an object containing all ndarray properties needed to revive a serialized ndarray...\n\tout = {};\n\tout.type = 'ndarray';\n\tout.dtype = this.dtype;\n\tout.flags = {\n\t\t'READONLY': this._flags.READONLY\n\t};\n\tout.order = this._order;\n\tout.shape = this._shape.slice();\n\tout.strides = this._strides.slice();\n\n\t// Flip the signs of negative strides:\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( out.strides[ i ] < 0 ) {\n\t\t\tout.strides[ i ] *= -1;\n\t\t}\n\t}\n\t// Cast data to generic array...\n\tout.data = [];\n\tif ( out.dtype === 'complex64' || out.dtype === 'complex128' ) {\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tv = this.iget( i );\n\t\t\tout.data.push( real( v ), imag( v ) );\n\t\t}\n\t} else {\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tout.data.push( this.iget( i ) );\n\t\t}\n\t}\n\treturn out;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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// MODULES //\n\nimport defaults from './main.js';\n\n\n// VARIABLES //\n\nvar DEFAULTS = defaults();\nvar HASH = {\n\t'dtypes.default': DEFAULTS.dtypes.default,\n\t'dtypes.numeric': DEFAULTS.dtypes.numeric,\n\t'dtypes.real': DEFAULTS.dtypes.real,\n\t'dtypes.floating_point': DEFAULTS.dtypes.floating_point,\n\t'dtypes.real_floating_point': DEFAULTS.dtypes.real_floating_point,\n\t'dtypes.complex_floating_point': DEFAULTS.dtypes.complex_floating_point,\n\t'dtypes.integer': DEFAULTS.dtypes.integer,\n\t'dtypes.signed_integer': DEFAULTS.dtypes.signed_integer,\n\t'dtypes.unsigned_integer': DEFAULTS.dtypes.unsigned_integer,\n\t'dtypes.boolean': DEFAULTS.dtypes.boolean,\n\t'order': DEFAULTS.order,\n\t'casting': DEFAULTS.casting,\n\t'index_mode': DEFAULTS.index_mode\n};\n\n\n// MAIN //\n\n/**\n* Returns a default ndarray setting.\n*\n* @param {string} name - setting name\n* @returns {*} default setting or null\n*\n* @example\n* var v = get( 'dtypes.default' );\n* // returns \n*/\nfunction get( name ) {\n\tvar v = HASH[ name ];\n\treturn ( v === void 0 ) ? null : v;\n}\n\n\n// EXPORTS //\n\nexport default get;\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 format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Tests that a value is a valid constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {(Error|null)} error object or null\n*\n* @example\n* var ctor = function ctor() {};\n*\n* var err = validate( ctor );\n* // returns null\n*\n* err = validate( null );\n* // returns \n*/\nfunction validate( value ) {\n\tvar type = typeof value;\n\tif (\n\t\tvalue === null ||\n\t\t(type !== 'object' && type !== 'function')\n\t) {\n\t\treturn new TypeError( format( 'invalid argument. A provided constructor must be either an object (except null) or a function. Value: `%s`.', value ) );\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 default ndarray settings.\n*\n* @module @stdlib/ndarray-defaults\n*\n* @example\n* import defaults from '@stdlib/ndarray-defaults';\n*\n* var o = defaults();\n* // returns {...}\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport get from './get.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'get', get );\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// EXPORTS //\n\nexport default Object.create;\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\n/**\n* Dummy constructor.\n*\n* @private\n*/\nfunction Ctor() {\n\t// Empty...\n}\n\n\n// MAIN //\n\n/**\n* An `Object.create` shim for older JavaScript engines.\n*\n* @private\n* @param {Object} proto - prototype\n* @returns {Object} created object\n*\n* @example\n* var obj = createObject( Object.prototype );\n* // returns {}\n*/\nfunction createObject( proto ) {\n\tCtor.prototype = proto;\n\treturn new Ctor();\n}\n\n\n// EXPORTS //\n\nexport default createObject;\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 builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar createObject;\nif ( typeof builtin === 'function' ) {\n\tcreateObject = builtin;\n} else {\n\tcreateObject = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default createObject;\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* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\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* Restricts an index to the interval `[0,max]`.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @returns {NonNegativeInteger} index\n*\n* @example\n* var idx = clampIndex( -1, 10 );\n* // returns 0\n*\n* idx = clampIndex( 15, 10 );\n* // returns 10\n*\n* idx = clampIndex( 5, 10 );\n* // returns 5\n*/\nfunction clampIndex( idx, max ) {\n\tif ( idx < 0 ) {\n\t\treturn 0;\n\t}\n\tif ( idx > max ) {\n\t\treturn max;\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default clampIndex;\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* Wraps an index on the interval `[0,max]`.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @returns {NonNegativeInteger} index\n*\n* @example\n* var idx = wrapIndex( -1, 10 );\n* // returns 10\n*\n* idx = wrapIndex( 13, 10 );\n* // returns 2\n*\n* idx = wrapIndex( 6, 10 );\n* // returns 6\n*/\nfunction wrapIndex( idx, max ) {\n\tvar mp1 = max + 1;\n\tif ( idx < 0 ) {\n\t\tidx += mp1; // slight optimization to avoid modulo arithmetic when |idx| <= max+1\n\t\tif ( idx < 0 ) {\n\t\t\tidx %= mp1;\n\t\t\tif ( idx !== 0 ) {\n\t\t\t\tidx += mp1;\n\t\t\t}\n\t\t}\n\t\treturn idx;\n\t}\n\tif ( idx > max ) {\n\t\tidx -= mp1; // slight optimization to avoid modulo arithmetic when max+1 < idx <= 2*(max+1)\n\t\tif ( idx > max ) {\n\t\t\tidx %= mp1;\n\t\t}\n\t\treturn idx;\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default wrapIndex;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* Normalizes an index to the interval `[0,max]`.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @returns {integer} index\n*\n* @example\n* var idx = normalizeIndex( -2, 10 );\n* // returns 9\n*\n* idx = normalizeIndex( 15, 10 );\n* // returns -1\n*\n* idx = normalizeIndex( 5, 10 );\n* // returns 5\n*/\nfunction normalizeIndex( idx, max ) {\n\tif ( idx < 0 ) {\n\t\tidx += max + 1;\n\t\tif ( idx < 0 ) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn idx;\n\t}\n\tif ( idx > max ) {\n\t\treturn -1;\n\t}\n\treturn idx;\n}\n\n\n// EXPORTS //\n\nexport default normalizeIndex;\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 { factory as contains } from '@stdlib/array-base-assert-contains';\nimport modes from '@stdlib/ndarray-index-modes';\n\n\n// MAIN //\n\n/**\n* Tests whether an input value is a supported ndarray index mode.\n*\n* @name isIndexMode\n* @type {Function}\n* @param {*} v - value to test\n* @returns {boolean} boolean indicating whether an input value is a supported ndarray index mode\n*\n* @example\n* var bool = isIndexMode( 'wrap' );\n* // returns true\n*\n* bool = isIndexMode( 'clamp' );\n* // returns true\n*\n* bool = isIndexMode( 'throw' );\n* // returns true\n*\n* bool = isIndexMode( 'foo' );\n* // returns false\n*/\nvar isIndexMode = contains( modes() );\n\n\n// EXPORTS //\n\nexport default isIndexMode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 clampIndex from '@stdlib/ndarray-base-clamp-index';\nimport wrapIndex from '@stdlib/ndarray-base-wrap-index';\nimport normalize from '@stdlib/ndarray-base-normalize-index';\nimport isIndexMode from '@stdlib/ndarray-base-assert-is-index-mode';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar TABLE = {\n\t'wrap': wrapIndex,\n\t'clamp': clampIndex,\n\t'normalize': normalizeIndex,\n\t'throw': throwIfOutOfBounds\n};\n\n\n// FUNCTIONS //\n\n/**\n* Returns an index if within bounds and throw an error otherwise.\n*\n* @private\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @throws {RangeError} index out-of-bounds\n* @returns {integer} index\n*\n* @example\n* var idx = throwIfOutOfBounds( 2, 9 );\n* // returns 2\n*\n* idx = throwIfOutOfBounds( 10, 9 );\n* // throws \n*\n* idx = throwIfOutOfBounds( -1, 9 );\n* // throws \n*/\nfunction throwIfOutOfBounds( idx, max ) {\n\tif ( idx < 0 || idx > max ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );\n\t}\n\treturn idx;\n}\n\n/**\n* Normalizes an index before performing a strict bounds check.\n*\n* @private\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @throws {RangeError} index out-of-bounds\n* @returns {integer} index\n*\n* @example\n* var idx = normalizeIndex( 1, 10 );\n* // returns 1\n*\n* idx = normalizeIndex( -4, 10 );\n* // returns 7\n*\n* idx = normalizeIndex( -100, 10 );\n* // throws \n*/\nfunction normalizeIndex( idx, max ) {\n\tvar index = normalize( idx, max );\n\tif ( index < 0 || index > max ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );\n\t}\n\treturn index;\n}\n\n\n// MAIN //\n\n/**\n* Returns a function for returning an index according to a provided index mode.\n*\n* @param {string} mode - specifies how to handle an out-of-bounds index\n* @throws {TypeError} first argument must be a recognized index mode\n* @returns {Function} function for returning an index\n*\n* @example\n* var ind = factory( 'clamp' );\n*\n* var idx = ind( 2, 9 );\n* // returns 2\n*\n* idx = ind( 10, 9 );\n* // returns 9\n*\n* idx = ind( -1, 9 );\n* // returns 0\n*\n* @example\n* var ind = factory( 'wrap' );\n*\n* var idx = ind( 2, 9 );\n* // returns 2\n*\n* idx = ind( 10, 9 );\n* // returns 0\n*\n* idx = ind( -1, 9 );\n* // returns 9\n*\n* @example\n* var ind = factory( 'throw' );\n*\n* var idx = ind( 2, 9 );\n* // returns 2\n*\n* idx = ind( 10, 9 );\n* // throws \n*\n* idx = ind( -1, 9 );\n* // throws \n*\n* @example\n* var ind = factory( 'normalize' );\n*\n* var idx = ind( 1, 10 );\n* // returns 1\n*\n* idx = ind( -4, 10 );\n* // returns 7\n*\n* idx = ind( -100, 10 );\n* // throws \n*/\nfunction factory( mode ) {\n\tif ( !isIndexMode( mode ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a recognized index mode. Value: `%s`.', mode ) );\n\t}\n\treturn TABLE[ mode ];\n}\n\n\n// EXPORTS //\n\nexport default factory;\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 clampIndex from '@stdlib/ndarray-base-clamp-index';\nimport wrapIndex from '@stdlib/ndarray-base-wrap-index';\nimport normalizeIndex from '@stdlib/ndarray-base-normalize-index';\nimport format from '@stdlib/string-format';\n\n\n// MAIN //\n\n/**\n* Returns an index given an index mode.\n*\n* @param {integer} idx - index\n* @param {NonNegativeInteger} max - maximum index\n* @param {string} mode - specifies how to handle an index outside the interval `[0,max]`\n* @throws {RangeError} index out-of-bounds\n* @returns {integer} index\n*\n* @example\n* var idx = ind( 2, 9, 'clamp' );\n* // returns 2\n*\n* idx = ind( 10, 9, 'clamp' );\n* // returns 9\n*\n* idx = ind( -1, 9, 'clamp' );\n* // returns 0\n*\n* @example\n* var idx = ind( 2, 9, 'wrap' );\n* // returns 2\n*\n* idx = ind( 10, 9, 'wrap' );\n* // returns 0\n*\n* idx = ind( -1, 9, 'wrap' );\n* // returns 9\n*\n* @example\n* var idx = ind( 2, 9, 'throw' );\n* // returns 2\n*\n* idx = ind( 10, 9, 'throw' );\n* // throws \n*\n* idx = ind( -1, 9, 'throw' );\n* // throws \n*\n* @example\n* var idx = ind( 1, 10, 'normalize' );\n* // returns 1\n*\n* idx = ind( -4, 10, 'normalize' );\n* // returns 7\n*\n* idx = ind( -100, 10, 'normalize' );\n* // throws \n*/\nfunction ind( idx, max, mode ) {\n\tvar index;\n\tif ( mode === 'clamp' ) {\n\t\treturn clampIndex( idx, max );\n\t}\n\tif ( mode === 'wrap' ) {\n\t\treturn wrapIndex( idx, max );\n\t}\n\tindex = idx;\n\tif ( mode === 'normalize' ) {\n\t\tindex = normalizeIndex( index, max );\n\t}\n\tif ( index < 0 || index > max ) {\n\t\tthrow new RangeError( format( 'invalid argument. Index must resolve to a value on the interval: [0, %d]. Value: `%d`.', max, idx ) );\n\t}\n\treturn index;\n}\n\n\n// EXPORTS //\n\nexport default ind;\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 an index given an index mode.\n*\n* @module @stdlib/ndarray-base-ind\n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( -1, 10, 'wrap' );\n* // returns 10\n*\n* idx = ind( 14, 10, 'wrap' );\n* // returns 3\n*\n* idx = ind( 6, 10, 'wrap' );\n* // returns 6\n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( -1, 10, 'clamp' );\n* // returns 0\n*\n* idx = ind( 14, 10, 'clamp' );\n* // returns 10\n*\n* idx = ind( 6, 10, 'clamp' );\n* // returns 6\n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( 1, 10, 'throw' );\n* // returns 1\n*\n* idx = ind( 14, 10, 'throw' );\n* // throws \n*\n* idx = ind( -1, 10, 'throw' );\n* // throws \n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var idx = ind( 1, 10, 'normalize' );\n* // returns 1\n*\n* idx = ind( -4, 10, 'normalize' );\n* // returns 7\n*\n* idx = ind( -100, 10, 'normalize' );\n* // throws \n*\n* @example\n* import ind from '@stdlib/ndarray-base-ind';\n*\n* var fcn = ind.factory( 'clamp' );\n*\n* var idx = fcn( -1, 10 );\n* // returns 0\n*\n* idx = fcn( 14, 10 );\n* // returns 10\n*\n* idx = fcn( 6, 10 );\n* // returns 6\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport factory from './factory.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\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/* eslint-disable no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport parent from '@stdlib/ndarray-base-ctor'; // eslint-disable-line stdlib/no-redeclare\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar base = parent.prototype.iget;\n\n\n// MAIN //\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @throws {TypeError} index must be an integer\n* @throws {RangeError} index exceeds array dimensions\n* @returns {*} array element\n*/\nfunction iget( idx ) {\n\tif ( this._ndims > 0 ) {\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( '0jp5O', idx ) );\n\t\t}\n\t\tidx = getIndex( idx, this._length-1, this._mode );\n\t\treturn base.call( this, idx );\n\t}\n\treturn base.call( this );\n}\n\n\n// EXPORTS //\n\nexport default iget;\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-invalid-this */\n\n'use strict';\n\n// METHODS //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport parent from '@stdlib/ndarray-base-ctor'; // eslint-disable-line stdlib/no-redeclare\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar base = parent.prototype.iset;\n\n\n// MAIN //\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @private\n* @param {integer} [idx] - linear view index\n* @param {*} v - value to set\n* @throws {Error} cannot write to a read-only array\n* @throws {TypeError} index must be an integer\n* @throws {RangeError} index exceeds array dimensions\n* @returns {ndarray} ndarray instance\n*/\nfunction iset( idx, v ) {\n\tif ( this._flags.READONLY ) {\n\t\tthrow new Error( format('0jp0e') );\n\t}\n\tif ( this._ndims > 0 ) {\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( '0jp5O', idx ) );\n\t\t}\n\t\tidx = getIndex( idx, this._length-1, this._mode );\n\t\tbase.call( this, idx, v );\n\t} else {\n\t\tbase.call( this, idx );\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default iset;\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* Copies the contents of array-like value to a new array.\n*\n* @private\n* @param {ArrayLike} arr - input array\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} output array\n*\n* @example\n* var arr = [ 1.0, 2.0, 3.0 ];\n*\n* var out = copy( arr, arr.length );\n* // returns [ 1.0, 2.0, 3.0 ]\n*\n* var bool = ( arr === out );\n* // returns false\n*/\nfunction copy( arr, len ) {\n\tvar out;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout.push( arr[ i ] );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default copy;\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 an object.\n*\n* @name Object\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {Object} object\n*\n* @example\n* var o = new Object( null );\n* // returns {}\n*\n* @example\n* var o = new Object( 5.0 );\n* // returns \n*\n* @example\n* var o = new Object( 'beep' );\n* // returns \n*\n* @example\n* var o1 = {};\n*\n* var o2 = new Object( o1 );\n* // returns {}\n*\n* var bool = ( o1 === o2 );\n* // returns true\n*/\nvar Obj = Object; // eslint-disable-line stdlib/require-globals\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// MODULES //\n\nimport isFunction from '@stdlib/assert-is-function';\nimport builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nexport default getProto;\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 getProto from './proto.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 from '@stdlib/assert-is-object';\nimport isFunction from '@stdlib/assert-is-function';\nimport getPrototypeOf from '@stdlib/utils-get-prototype-of';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport nativeClass from '@stdlib/utils-native-class';\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPlainObject;\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 Object from '@stdlib/object-ctor';\nimport getProto from './detect.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport isCollection from '@stdlib/assert-is-collection';\nimport { primitives as isNonNegativeIntegerArray } from '@stdlib/assert-is-nonnegative-integer-array';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert-is-nonnegative-integer';\nimport { primitives as isIntegerArray } from '@stdlib/assert-is-integer-array';\nimport isFunction from '@stdlib/assert-is-function';\nimport isOrder from '@stdlib/ndarray-base-assert-is-order';\nimport isDataType from '@stdlib/ndarray-base-assert-is-data-type';\nimport isBufferLengthCompatible from '@stdlib/ndarray-base-assert-is-buffer-length-compatible';\nimport numel from '@stdlib/ndarray-base-numel';\nimport parent from '@stdlib/ndarray-base-ctor'; // eslint-disable-line stdlib/no-redeclare\nimport defaults from '@stdlib/ndarray-defaults';\nimport inherit from '@stdlib/utils-inherit';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport iget from './iget.js';\nimport iset from './iset.js';\nimport get from './get.js';\nimport set from './set.js';\nimport copy from './copy_array.js';\nimport validate from './validate.js';\n\n\n// VARIABLES //\n\n/*\n* See the following references:\n*\n* - https://stackoverflow.com/questions/22747068/is-there-a-max-number-of-arguments-javascript-functions-can-accept\n* - https://bugs.webkit.org/show_bug.cgi?id=80797\n* - https://github.com/numpy/numpy/issues/5744\n*\n* Note that the maximum number of function arguments can vary from engine to engine. Here, we choose something of a lowest common denominator which may **not** be valid everywhere.\n*/\nvar MAX_DIMS = 32767|0;\n\nvar INDEX_MODE = defaults.get( 'index_mode' );\nvar READONLY = false;\n\n\n// MAIN //\n\n/**\n* ndarray constructor.\n*\n* @constructor\n* @param {string} dtype - data type\n* @param {Collection} buffer - data buffer\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - array strides\n* @param {NonNegativeInteger} offset - index offset\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {Options} [options] - function options\n* @param {string} [options.mode=\"throw\"] - specifies how to handle indices which exceed array dimensions\n* @param {StringArray} [options.submode=[\"throw\"]] - specifies how to handle subscripts which exceed array dimensions on a per dimension basis\n* @param {boolean} [options.readonly=false] - boolean indicating whether an array should be read-only\n* @throws {TypeError} `dtype` argument must be a supported ndarray data type\n* @throws {TypeError} `buffer` argument must be an array-like object, typed-array-like, or a Buffer\n* @throws {TypeError} `buffer` argument `get` and `set` properties must be functions\n* @throws {TypeError} `shape` argument must be an array-like object containing nonnegative integers\n* @throws {Error} `shape` argument length must equal the number of dimensions\n* @throws {TypeError} `strides` argument must be an array-like object containing integers\n* @throws {Error} `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`)\n* @throws {Error} for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0`\n* @throws {TypeError} `offset` argument must be a nonnegative integer\n* @throws {TypeError} `order` argument must be a supported ndarray order\n* @throws {Error} `buffer` argument must be compatible with specified meta data\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} too many dimensions\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*/\nfunction ndarray( dtype, buffer, shape, strides, offset, order, options ) {\n\tvar ndims;\n\tvar opts;\n\tvar err;\n\tvar sh;\n\tvar st;\n\n\tif ( !(this instanceof ndarray) ) {\n\t\tif ( arguments.length < 7 ) {\n\t\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order );\n\t\t}\n\t\treturn new ndarray( dtype, buffer, shape, strides, offset, order, options ); // eslint-disable-line max-len\n\t}\n\tif ( !isDataType( dtype ) ) {\n\t\tthrow new TypeError( format( '0jp5P', dtype ) );\n\t}\n\tif ( !isCollection( buffer ) ) {\n\t\tthrow new TypeError( format( '0jp5Q', buffer ) );\n\t} else if ( buffer.get && buffer.set && ( !isFunction( buffer.get ) || !isFunction( buffer.set ) ) ) { // eslint-disable-line max-len\n\t\tthrow new TypeError( format( '0jp5R', buffer ) );\n\t}\n\tif ( !isNonNegativeIntegerArray( shape ) ) {\n\t\tif ( !isCollection( shape) || shape.length > 0 ) {\n\t\t\tthrow new TypeError( format( '0jp5S', shape ) );\n\t\t}\n\t}\n\tndims = shape.length;\n\tif ( ndims > MAX_DIMS ) {\n\t\tthrow new RangeError( format( '0jp5T', MAX_DIMS, ndims ) );\n\t}\n\tif ( !isIntegerArray( strides ) ) {\n\t\tthrow new TypeError( format( '0jp5U', strides ) );\n\t}\n\tif ( ndims > 0 ) {\n\t\tif ( strides.length !== ndims ) {\n\t\t\tthrow new RangeError( format( '0jp5V', ndims, strides.length ) );\n\t\t}\n\t} else if ( strides.length !== 1 ) {\n\t\tthrow new RangeError( format('0jp0f') );\n\t} else if ( strides[ 0 ] !== 0 ) {\n\t\tthrow new RangeError( format( '0jpDt', strides[ 0 ] ) );\n\t}\n\tif ( !isNonNegativeInteger( offset ) ) {\n\t\tthrow new TypeError( format( '0jp5X', offset ) );\n\t}\n\tif ( !isOrder( order ) ) {\n\t\tthrow new TypeError( format( '0jp5Y', order ) );\n\t}\n\tif ( ndims > 0 && !isBufferLengthCompatible( buffer.length, shape, strides, offset ) && numel( shape ) > 0 ) { // eslint-disable-line max-len\n\t\tthrow new Error( format('0jpCz') );\n\t}\n\topts = {};\n\topts.mode = INDEX_MODE;\n\topts.readonly = READONLY;\n\tif ( arguments.length > 6 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tthis._mode = opts.mode;\n\tif ( opts.submode === void 0 ) {\n\t\topts.submode = [ this._mode ];\n\t}\n\tthis._submode = opts.submode;\n\n\t// Copy `shape` and `strides` to prevent external mutation:\n\tsh = copy( shape, ndims );\n\tst = copy( strides, ndims || 1 );\n\n\t// Call the parent constructor:\n\tparent.call( this, dtype, buffer, sh, st, offset, order );\n\tthis._flags.READONLY = opts.readonly;\n\n\treturn this;\n\n\t/* eslint-enable no-invalid-this */\n}\n\n// Inherit from the parent constructor:\ninherit( ndarray, parent );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof ndarray\n* @type {string}\n* @default 'ndarray'\n*\n* @example\n* var str = ndarray.name;\n* // returns 'ndarray'\n*/\nsetReadOnly( ndarray, 'name', 'ndarray' );\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name get\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'get', get );\n\n/**\n* Returns an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided.\n*\n* @name iget\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @returns {*} array element\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*/\nsetReadOnly( ndarray.prototype, 'iget', iget );\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @name set\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.get( 1, 1 );\n* // returns 4\n*\n* x.set( 1, 1, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.get( 1, 1 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'set', set );\n\n/**\n* Sets an array element located at a specified linear index.\n*\n* ## Notes\n*\n* - For zero-dimensional arrays, the first, and only, argument should be the value to set.\n*\n* @name iset\n* @memberof ndarray.prototype\n* @type {Function}\n* @param {integer} [idx] - linear index\n* @param {*} v - value to set\n* @returns {ndarray} ndarray instance\n*\n* @example\n* var buffer = [ 1, 2, 3, 4, 5, 6 ];\n* var shape = [ 3, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );\n*\n* var v = x.iget( 3 );\n* // returns 4\n*\n* x.iset( 3, 10 );\n*\n* var b = x.data;\n* // returns [ 1, 2, 3, 10, 5, 6 ]\n*\n* v = x.iget( 3 );\n* // returns 10\n*/\nsetReadOnly( ndarray.prototype, 'iset', iset );\n\n\n// EXPORTS //\n\nexport default ndarray;\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 minmax from '@stdlib/ndarray-base-minmax-view-buffer-index';\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a buffer length is compatible with provided ndarray meta data.\n*\n* @param {NonNegativeInteger} len - buffer length\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - index offset\n* @returns {boolean} boolean indicating if a buffer length is compatible\n*\n* @example\n* var shape = [ 2, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 0;\n*\n* var bool = isBufferLengthCompatible( 4, shape, strides, offset );\n* // returns true\n*\n* @example\n* var shape = [ 2, 2 ];\n* var strides = [ 2, 1 ];\n* var offset = 2;\n*\n* var bool = isBufferLengthCompatible( 4, shape, strides, offset );\n* // returns false\n*/\nfunction isBufferLengthCompatible( len, shape, strides, offset ) {\n\t// Determine the minimum and maximum linear indices which are accessible by the array view:\n\tvar buf = minmax( shape, strides, offset );\n\n\t// If the indices are \"inbounds\", then the buffer length is compatible:\n\treturn ( buf[ 0 ] >= 0 && buf[ 1 ] < len );\n}\n\n\n// EXPORTS //\n\nexport default isBufferLengthCompatible;\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 number of elements in an array.\n*\n* @param {(NonNegativeIntegerArray|EmptyArray)} shape - array shape\n* @returns {NonNegativeInteger} number of elements\n*\n* @example\n* var n = numel( [ 3, 3, 3 ] );\n* // returns 27\n*/\nfunction numel( shape ) {\n\tvar ndims;\n\tvar n;\n\tvar i;\n\n\tndims = shape.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0;\n\t}\n\tn = 1;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tn *= shape[ i ];\n\t}\n\treturn n;\n}\n\n\n// EXPORTS //\n\nexport default numel;\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 from '@stdlib/assert-is-plain-object';\nimport hasOwnProp from '@stdlib/assert-has-own-property';\nimport isArrayLikeObject from '@stdlib/assert-is-array-like-object';\nimport isIndexMode from '@stdlib/ndarray-base-assert-is-index-mode';\nimport { isPrimitive as isBoolean } from '@stdlib/assert-is-boolean';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.mode] - specifies how to handle indices which exceed array dimensions\n* @param {StringArray} [options.submode] - specifies how to handle subscripts which exceed array dimensions\n* @param {boolean} [options.readonly] - boolean indicating whether an array should be read-only\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'mode': 'clamp',\n* 'submode': [ 'throw', 'wrap', 'clamp' ]\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tvar i;\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( '0jp2V', options ) );\n\t}\n\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\topts.mode = options.mode;\n\t\tif ( !isIndexMode( opts.mode ) ) {\n\t\t\treturn new TypeError( format( '0jp5a', 'mode', opts.mode ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'submode' ) ) {\n\t\topts.submode = options.submode;\n\t\tif ( !isArrayLikeObject( opts.submode ) ) {\n\t\t\treturn new TypeError( format( '0jp5b', 'submode', opts.submode ) );\n\t\t}\n\t\tif ( opts.submode.length === 0 ) {\n\t\t\treturn new TypeError( format( '0jp5b', 'submode', opts.submode.join( ',' ) ) );\n\t\t}\n\t\tfor ( i = 0; i < opts.submode.length; i++ ) {\n\t\t\tif ( !isIndexMode( opts.submode[ i ] ) ) {\n\t\t\t\treturn new TypeError( format( '0jp5c', opts.submode[ i ] ) );\n\t\t\t}\n\t\t}\n\t\topts.submode = opts.submode.slice();\n\t}\n\tif ( hasOwnProp( options, 'readonly' ) ) {\n\t\topts.readonly = options.readonly;\n\t\tif ( !isBoolean( opts.readonly ) ) {\n\t\t\treturn new TypeError( format( '0jp2o', 'readonly', opts.readonly ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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';\nimport format from '@stdlib/string-format';\nimport validate from './validate.js';\nimport createObject from './detect.js';\n\n\n// MAIN //\n\n/**\n* Implements prototypical inheritance by replacing the prototype of one constructor with the prototype of another constructor.\n*\n* ## Notes\n*\n* - This implementation is not designed to work with ES2015/ES6 classes. For ES2015/ES6 classes, use `class` with `extends`.\n* - For reference, see [node#3455](https://github.com/nodejs/node/pull/3455), [node#4179](https://github.com/nodejs/node/issues/4179), [node#3452](https://github.com/nodejs/node/issues/3452), and [node commit](https://github.com/nodejs/node/commit/29da8cf8d7ab8f66b9091ab22664067d4468461e#diff-3deb3f32958bb937ae05c6f3e4abbdf5).\n*\n* @param {(Object|Function)} ctor - constructor which will inherit\n* @param {(Object|Function)} superCtor - super (parent) constructor\n* @throws {TypeError} first argument must be either an object or a function which can inherit\n* @throws {TypeError} second argument must be either an object or a function from which a constructor can inherit\n* @throws {TypeError} second argument must have an inheritable prototype\n* @returns {(Object|Function)} child constructor\n*\n* @example\n* function Foo() {\n* return this;\n* }\n* Foo.prototype.beep = function beep() {\n* return 'boop';\n* };\n*\n* function Bar() {\n* Foo.call( this );\n* return this;\n* }\n* inherit( Bar, Foo );\n*\n* var bar = new Bar();\n* var v = bar.beep();\n* // returns 'boop'\n*/\nfunction inherit( ctor, superCtor ) {\n\tvar err = validate( ctor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\terr = validate( superCtor );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tif ( typeof superCtor.prototype === 'undefined' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must have a prototype from which another object can inherit. Value: `%s`.', superCtor.prototype ) );\n\t}\n\t// Create a prototype which inherits from the parent prototype:\n\tctor.prototype = createObject( superCtor.prototype );\n\n\t// Set the constructor to refer to the child constructor:\n\tdefineProperty( ctor.prototype, 'constructor', {\n\t\t'configurable': true,\n\t\t'enumerable': false,\n\t\t'writable': true,\n\t\t'value': ctor\n\t});\n\n\treturn ctor;\n}\n\n\n// EXPORTS //\n\nexport default inherit;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Returns an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @throws {TypeError} provided indices must be integer valued\n* @throws {RangeError} index exceeds array dimensions\n* @throws {RangeError} number of indices must equal the number of dimensions\n* @returns {*} array element\n*/\nfunction get() {\n\tvar idx;\n\tvar ind;\n\tvar M;\n\tvar i;\n\n\tif ( arguments.length !== this._ndims ) {\n\t\tthrow new RangeError( format( '0jp5M', this._ndims, arguments.length ) );\n\t}\n\tidx = this._offset;\n\tM = this._submode.length;\n\tfor ( i = 0; i < arguments.length; i++ ) {\n\t\tif ( !isInteger( arguments[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0jp5N', i, arguments[ i ] ) );\n\t\t}\n\t\tind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len\n\t\tidx += this._strides[ i ] * ind;\n\t}\n\tif ( this._accessors ) {\n\t\treturn this._buffer.get( idx );\n\t}\n\treturn this._buffer[ idx ];\n}\n\n\n// EXPORTS //\n\nexport default get;\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-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isInteger } from '@stdlib/assert-is-integer';\nimport getIndex from '@stdlib/ndarray-base-ind';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// MAIN //\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided.\n*\n* @private\n* @param {...integer} [idx] - indices\n* @param {*} v - value to set\n* @throws {Error} cannot write to a read-only array\n* @throws {TypeError} provided indices must be integer valued\n* @throws {RangeError} index exceeds array dimensions\n* @throws {RangeError} number of indices must equal the number of dimensions\n* @returns {ndarray} ndarray instance\n*/\nfunction set() {\n\tvar idx;\n\tvar ind;\n\tvar M;\n\tvar i;\n\n\tif ( this._flags.READONLY ) {\n\t\tthrow new Error( format('0jp0e') );\n\t}\n\tif ( arguments.length !== this._ndims+1 ) {\n\t\tthrow new RangeError( format( '0jp5M', this._ndims, arguments.length ) );\n\t}\n\tidx = this._offset;\n\tM = this._submode.length;\n\tfor ( i = 0; i < arguments.length-1; i++ ) {\n\t\tif ( !isInteger( arguments[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0jpDu', i, arguments[ i ] ) );\n\t\t}\n\t\tind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len\n\t\tidx += this._strides[ i ] * ind;\n\t}\n\tif ( this._accessors ) {\n\t\tthis._buffer.set( arguments[ i ], idx );\n\t} else {\n\t\tthis._buffer[ idx ] = arguments[ i ];\n\t}\n\treturn this;\n}\n\n\n// EXPORTS //\n\nexport default set;\n"],"names":["main","Object","defineProperty","isNumber","value","zeros","n","i","out","zeroPad","str","width","right","negative","pad","length","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","push","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","defineProperty$1","setNonEnumerableReadOnly","configurable","enumerable","writable","floor","isInteger","x","MAX_TYPED_ARRAY_LENGTH","isCollection","MAX_LENGTH","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","nativeClass","hasToStringTag","v","isOwn","tag","main$e","Number","test","isPrimitive","isObject","setReadOnly","FLOAT64_PINF","POSITIVE_INFINITY","FLOAT64_NINF","NEGATIVE_INFINITY","PINF","NINF","isInt","valueOf","isNonNegativeInteger","MAX_ARRAY_LENGTH","arraylikefcn","predicate","len","isArrayLike","isPrimitiveArray","arrayfun","isObjectArray","isNonNegativeIntegerArray","isIntegerArray","isBoolean","Bool","Boolean","self","window","global","globalThis","getGlobal","codegen","Function","GlobalThis","Self","Win","Global","root","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$d","isObjectLike","isObjectLikeArray","isBuffer","_isBuffer","constructor","constructorName","name","ctor","ctorName","type","isFunction","typeOf","orders","ORDERS","enumerated","DATA","enumeration","LAYOUTS","TYPE","isAccessorArray","GETTERS","complex128","arr","idx","complex64","default","getter","dtype","float64","float32","int32","int16","int8","uint32","uint16","uint8","uint8c","generic","ctor2dtypes","Float32Array","Float64Array","Int16Array","Int32Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","Complex64Array","Complex128Array","hasFloat64Array","bool","GlobalFloat64Array","NaN","hasFloat64ArraySupport","Float64Array$1","hasFloat32Array","GlobalFloat32Array","hasFloat32ArraySupport","Float32Array$1","hasUint32Array","UINT32_MAX","GlobalUint32Array","hasUint32ArraySupport","Uint32Array$1","hasInt32Array","GlobalInt32Array","INT32_MAX","hasInt32ArraySupport","Int32Array$1","hasUint16Array","GlobalUint16Array","UINT16_MAX","hasUint16ArraySupport","Uint16Array$1","hasInt16Array","GlobalInt16Array","INT16_MAX","hasInt16ArraySupport","Int16Array$1","hasUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","Uint8Array$1","hasUint8ClampedArray","GlobalUint8ClampedArray","hasUint8ClampedArraySupport","Uint8ClampedArray$1","hasInt8Array","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","Int8Array$1","isArrayLikeObject","hasArrayBuffer","ArrayBuffer","isArrayBuffer","isString","Complex128","real","imag","this","re","im","fround","FLOAT32_VIEW","float64ToFloat32$1","Complex64","float64ToFloat32","isComplexLike","isEven","BYTES_PER_ELEMENT","isComplex64Array","isComplex128Array","hasIteratorSymbolSupport","iterator","IteratorSymbol","setNonEnumerableReadOnlyAccessor","realf","z","imagf","reinterpret","offset","buffer","byteOffset","fromIterator","it","next","done","HAS_ITERATOR_SYMBOL","isComplexArray","_length","_buffer","isComplexArrayConstructor","getComplex64","buf","nargs","fromArray","RangeError","reinterpret64","reinterpret128","byteLength","ITERATOR_SYMBOL","src","thisArg","clbk","tmp","flg","accessorGetter","fromIteratorMap","target","start","copyWithin","iter","entries","end","fcn","searchElement","fromIndex","separator","sep","join","outbuf","reducer","initialValue","acc","N","sbuf","outlen","begin","index","getComplex128","CTORS","DTYPES","NTYPES","ctor2dtype","factory","dt","search","newval","RE_SUFFIX","dtypes","kind","all","int64","uint64","binary","notype","userdefined_type","keys","isArguments","bool$7","detect","hasArgumentsClass","isNan","isEnumerableProperty","propertyIsEnumerable","hasStringEnumBug","isEnum","isArguments$1","isConstructorPrototype","w","hasAutomationEqualityBug","k","win","EXCLUDED_KEYS","check","HAS_BUILTIN","skipConstructor","skipPrototype","isFcn","p","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","HAS_WINDOW","error","NON_ENUMERABLE","main$2","source","objectKeys","assign","isDataType","contains","minmaxViewBufferIndex","shape","strides","ndims","min","max","s","isColumnMajorContiguous","order","contiguous","isRowMajorContiguous","RE_CHARS","RegExp","isRegExp","rescape","uint16view","ctors","IS_LITTLE_ENDIAN","view","GlobalArrayBuffer","isView","hasArrayBufferSupport","ArrayBuffer$1","hasDataView","DataView","GlobalDataView","getFloat64","setFloat64","hasDataViewSupport","DataView$1","BigInteger","BigInt","modes","MODES","throw","clamp","wrap","normalize","LOW_MASK","TWO_32","BYTES","VIEW","float64ToInt64Bytes","stride","hi","lo","setUint32","bytes","ndarray","nbytes","ord","_byteLength","_bytesPerElement","bytesPerElement","_dtype","_ndims","_offset","_order","_shape","_strides","_accessors","_iterationOrder","cnt","iterationOrder","isContiguous","column","row","s1","s2","strides2order","_flags","ROW_MAJOR_CONTIGUOUS","COLUMN_MAJOR_CONTIGUOUS","READONLY","__meta_dataview__","defaults","numeric","floating_point","real_floating_point","complex_floating_point","integer","signed_integer","unsigned_integer","boolean","casting","index_mode","ind","iget","data","flgs","sh","st","sm","m","o","M","_mode","_submode","setInt8","setInt16","setBigInt64","setInt32","DEFAULTS","HASH","validate","create","Ctor","createObject$1","proto","fmtprodmsg","a","u","encodeURIComponent","clampIndex","wrapIndex","mp1","normalizeIndex","isIndexMode","TABLE","mode","parent","iset","copy","getProto","Obj","getPrototypeOf","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","key","ownProps","INDEX_MODE","options","opts","isOrder","minmax","isBufferLengthCompatible","numel","readonly","submode","superCtor","createObject","inherit","getIndex"],"mappings":";wOAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCrF,IAAIA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAAS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,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,307,308,309,310,311,312,313,315,316,318]} \ No newline at end of file diff --git a/lib/copy_array.js b/lib/copy_array.js deleted file mode 100644 index 2b7c36d..0000000 --- a/lib/copy_array.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Copies the contents of array-like value to a new array. -* -* @private -* @param {ArrayLike} arr - input array -* @param {NonNegativeInteger} len - array length -* @returns {Array} output array -* -* @example -* var arr = [ 1.0, 2.0, 3.0 ]; -* -* var out = copy( arr, arr.length ); -* // returns [ 1.0, 2.0, 3.0 ] -* -* var bool = ( arr === out ); -* // returns false -*/ -function copy( arr, len ) { - var out; - var i; - - out = []; - for ( i = 0; i < len; i++ ) { - out.push( arr[ i ] ); - } - return out; -} - - -// EXPORTS // - -module.exports = copy; diff --git a/lib/get.js b/lib/get.js deleted file mode 100644 index aa0b526..0000000 --- a/lib/get.js +++ /dev/null @@ -1,73 +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. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var getIndex = require( '@stdlib/ndarray-base-ind' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Returns an array element. -* -* ## Notes -* -* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided. -* -* @private -* @param {...integer} [idx] - indices -* @throws {TypeError} provided indices must be integer valued -* @throws {RangeError} index exceeds array dimensions -* @throws {RangeError} number of indices must equal the number of dimensions -* @returns {*} array element -*/ -function get() { - var idx; - var ind; - var M; - var i; - - if ( arguments.length !== this._ndims ) { - throw new RangeError( format( 'invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.', this._ndims, arguments.length ) ); - } - idx = this._offset; - M = this._submode.length; - for ( i = 0; i < arguments.length; i++ ) { - if ( !isInteger( arguments[ i ] ) ) { - throw new TypeError( format( 'invalid argument. Indices must be integer valued. Argument: `%u`. Value: `%s`.', i, arguments[ i ] ) ); - } - ind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len - idx += this._strides[ i ] * ind; - } - if ( this._accessors ) { - return this._buffer.get( idx ); - } - return this._buffer[ idx ]; -} - - -// EXPORTS // - -module.exports = get; diff --git a/lib/iget.js b/lib/iget.js deleted file mode 100644 index 58487d2..0000000 --- a/lib/iget.js +++ /dev/null @@ -1,65 +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. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var getIndex = require( '@stdlib/ndarray-base-ind' ); -var parent = require( '@stdlib/ndarray-base-ctor' ); // eslint-disable-line stdlib/no-redeclare -var format = require( '@stdlib/string-format' ); - - -// VARIABLES // - -var base = parent.prototype.iget; - - -// MAIN // - -/** -* Returns an array element located at a specified linear index. -* -* ## Notes -* -* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided. -* -* @private -* @param {integer} [idx] - linear view index -* @throws {TypeError} index must be an integer -* @throws {RangeError} index exceeds array dimensions -* @returns {*} array element -*/ -function iget( idx ) { - if ( this._ndims > 0 ) { - if ( !isInteger( idx ) ) { - throw new TypeError( format( 'invalid argument. Index must be an integer. Value: `%s`.', idx ) ); - } - idx = getIndex( idx, this._length-1, this._mode ); - return base.call( this, idx ); - } - return base.call( this ); -} - - -// EXPORTS // - -module.exports = iget; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 194ceb8..0000000 --- a/lib/index.js +++ /dev/null @@ -1,44 +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'; - -/** -* Multidimensional array constructor. -* -* @module @stdlib/ndarray-ctor -* -* @example -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/iset.js b/lib/iset.js deleted file mode 100644 index d1df9cf..0000000 --- a/lib/iset.js +++ /dev/null @@ -1,72 +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. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// METHODS // - -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var getIndex = require( '@stdlib/ndarray-base-ind' ); -var parent = require( '@stdlib/ndarray-base-ctor' ); // eslint-disable-line stdlib/no-redeclare -var format = require( '@stdlib/string-format' ); - - -// VARIABLES // - -var base = parent.prototype.iset; - - -// MAIN // - -/** -* Sets an array element located at a specified linear index. -* -* ## Notes -* -* - For zero-dimensional arrays, the first, and only, argument should be the value to set. -* -* @private -* @param {integer} [idx] - linear view index -* @param {*} v - value to set -* @throws {Error} cannot write to a read-only array -* @throws {TypeError} index must be an integer -* @throws {RangeError} index exceeds array dimensions -* @returns {ndarray} ndarray instance -*/ -function iset( idx, v ) { - if ( this._flags.READONLY ) { - throw new Error( 'invalid invocation. Cannot write to a read-only array.' ); - } - if ( this._ndims > 0 ) { - if ( !isInteger( idx ) ) { - throw new TypeError( format( 'invalid argument. Index must be an integer. Value: `%s`.', idx ) ); - } - idx = getIndex( idx, this._length-1, this._mode ); - base.call( this, idx, v ); - } else { - base.call( this, idx ); - } - return this; -} - - -// EXPORTS // - -module.exports = iset; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 9f1aa64..0000000 --- a/lib/main.js +++ /dev/null @@ -1,325 +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. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); -var isCollection = require( '@stdlib/assert-is-collection' ); -var isNonNegativeIntegerArray = require( '@stdlib/assert-is-nonnegative-integer-array' ).primitives; -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var isIntegerArray = require( '@stdlib/assert-is-integer-array' ).primitives; -var isFunction = require( '@stdlib/assert-is-function' ); -var isOrder = require( '@stdlib/ndarray-base-assert-is-order' ); -var isDataType = require( '@stdlib/ndarray-base-assert-is-data-type' ); -var isBufferLengthCompatible = require( '@stdlib/ndarray-base-assert-is-buffer-length-compatible' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var parent = require( '@stdlib/ndarray-base-ctor' ); // eslint-disable-line stdlib/no-redeclare -var defaults = require( '@stdlib/ndarray-defaults' ); -var inherit = require( '@stdlib/utils-inherit' ); -var format = require( '@stdlib/string-format' ); -var iget = require( './iget.js' ); -var iset = require( './iset.js' ); -var get = require( './get.js' ); -var set = require( './set.js' ); -var copy = require( './copy_array.js' ); -var validate = require( './validate.js' ); - - -// VARIABLES // - -/* -* See the following references: -* -* - https://stackoverflow.com/questions/22747068/is-there-a-max-number-of-arguments-javascript-functions-can-accept -* - https://bugs.webkit.org/show_bug.cgi?id=80797 -* - https://github.com/numpy/numpy/issues/5744 -* -* Note that the maximum number of function arguments can vary from engine to engine. Here, we choose something of a lowest common denominator which may **not** be valid everywhere. -*/ -var MAX_DIMS = 32767|0; - -var INDEX_MODE = defaults.get( 'index_mode' ); -var READONLY = false; - - -// MAIN // - -/** -* ndarray constructor. -* -* @constructor -* @param {string} dtype - data type -* @param {Collection} buffer - data buffer -* @param {NonNegativeIntegerArray} shape - array shape -* @param {IntegerArray} strides - array strides -* @param {NonNegativeInteger} offset - index offset -* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style) -* @param {Options} [options] - function options -* @param {string} [options.mode="throw"] - specifies how to handle indices which exceed array dimensions -* @param {StringArray} [options.submode=["throw"]] - specifies how to handle subscripts which exceed array dimensions on a per dimension basis -* @param {boolean} [options.readonly=false] - boolean indicating whether an array should be read-only -* @throws {TypeError} `dtype` argument must be a supported ndarray data type -* @throws {TypeError} `buffer` argument must be an array-like object, typed-array-like, or a Buffer -* @throws {TypeError} `buffer` argument `get` and `set` properties must be functions -* @throws {TypeError} `shape` argument must be an array-like object containing nonnegative integers -* @throws {Error} `shape` argument length must equal the number of dimensions -* @throws {TypeError} `strides` argument must be an array-like object containing integers -* @throws {Error} `strides` argument length must equal the number of dimensions (except for zero-dimensional arrays; in which case, the `strides` argument length must be equal to `1`) -* @throws {Error} for zero-dimensional ndarrays, the `strides` argument must contain a single element equal to `0` -* @throws {TypeError} `offset` argument must be a nonnegative integer -* @throws {TypeError} `order` argument must be a supported ndarray order -* @throws {Error} `buffer` argument must be compatible with specified meta data -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @throws {RangeError} too many dimensions -* @returns {ndarray} ndarray instance -* -* @example -* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var out = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -*/ -function ndarray( dtype, buffer, shape, strides, offset, order, options ) { - var ndims; - var opts; - var err; - var sh; - var st; - - if ( !(this instanceof ndarray) ) { - if ( arguments.length < 7 ) { - return new ndarray( dtype, buffer, shape, strides, offset, order ); - } - return new ndarray( dtype, buffer, shape, strides, offset, order, options ); // eslint-disable-line max-len - } - if ( !isDataType( dtype ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a supported ndarray data type. Value: `%s`.', dtype ) ); - } - if ( !isCollection( buffer ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an array-like object, typed-array-like, or a Buffer. Value: `%s`.', buffer ) ); - } else if ( buffer.get && buffer.set && ( !isFunction( buffer.get ) || !isFunction( buffer.set ) ) ) { // eslint-disable-line max-len - throw new TypeError( format( 'invalid argument. Second argument `get` and `set` properties must be functions. Value: `%s`.', buffer ) ); - } - if ( !isNonNegativeIntegerArray( shape ) ) { - if ( !isCollection( shape) || shape.length > 0 ) { - throw new TypeError( format( 'invalid argument. Third argument must be an array-like object containing nonnegative integers. Value: `%s`.', shape ) ); - } - } - ndims = shape.length; - if ( ndims > MAX_DIMS ) { - throw new RangeError( format( 'invalid argument. Number of dimensions must not exceed %u due to stack limits. Value: `%u`.', MAX_DIMS, ndims ) ); - } - if ( !isIntegerArray( strides ) ) { - throw new TypeError( format( 'invalid argument. Fourth argument must be an array-like object containing integers. Value: `%s`.', strides ) ); - } - if ( ndims > 0 ) { - if ( strides.length !== ndims ) { - throw new RangeError( format( 'invalid argument. Fourth argument length must match the number of dimensions. Expected number of dimensions: `%u`. Strides length: `%u`.', ndims, strides.length ) ); - } - } else if ( strides.length !== 1 ) { - throw new RangeError( 'invalid argument. Fourth argument length must be equal to 1 when creating a zero-dimensional ndarray.' ); - } else if ( strides[ 0 ] !== 0 ) { - throw new RangeError( format( 'invalid argument. Fourth argument must contain a single element equal to 0. Value: `%d`.', strides[ 0 ] ) ); - } - if ( !isNonNegativeInteger( offset ) ) { - throw new TypeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%s`.', offset ) ); - } - if ( !isOrder( order ) ) { - throw new TypeError( format( 'invalid argument. Sixth argument must be a supported order. Value: `%s`.', order ) ); - } - if ( ndims > 0 && !isBufferLengthCompatible( buffer.length, shape, strides, offset ) && numel( shape ) > 0 ) { // eslint-disable-line max-len - throw new Error( 'invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.' ); - } - opts = {}; - opts.mode = INDEX_MODE; - opts.readonly = READONLY; - if ( arguments.length > 6 ) { - err = validate( opts, options ); - if ( err ) { - throw err; - } - } - this._mode = opts.mode; - if ( opts.submode === void 0 ) { - opts.submode = [ this._mode ]; - } - this._submode = opts.submode; - - // Copy `shape` and `strides` to prevent external mutation: - sh = copy( shape, ndims ); - st = copy( strides, ndims || 1 ); - - // Call the parent constructor: - parent.call( this, dtype, buffer, sh, st, offset, order ); - this._flags.READONLY = opts.readonly; - - return this; - - /* eslint-enable no-invalid-this */ -} - -// Inherit from the parent constructor: -inherit( ndarray, parent ); - -/** -* Constructor name. -* -* @name name -* @memberof ndarray -* @type {string} -* @default 'ndarray' -* -* @example -* var str = ndarray.name; -* // returns 'ndarray' -*/ -setReadOnly( ndarray, 'name', 'ndarray' ); - -/** -* Returns an array element. -* -* ## Notes -* -* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided. -* -* @name get -* @memberof ndarray.prototype -* @type {Function} -* @param {...integer} [idx] - indices -* @returns {*} array element -* -* @example -* var buffer = [ 1, 2, 3, 4, 5, 6 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -* -* var v = x.get( 1, 1 ); -* // returns 4 -*/ -setReadOnly( ndarray.prototype, 'get', get ); - -/** -* Returns an array element located at a specified linear index. -* -* ## Notes -* -* - For zero-dimensional arrays, the input argument is ignored and, for clarity, should not be provided. -* -* @name iget -* @memberof ndarray.prototype -* @type {Function} -* @param {integer} [idx] - linear index -* @returns {*} array element -* -* @example -* var buffer = [ 1, 2, 3, 4, 5, 6 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -* -* var v = x.iget( 3 ); -* // returns 4 -*/ -setReadOnly( ndarray.prototype, 'iget', iget ); - -/** -* Sets an array element. -* -* ## Notes -* -* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided. -* -* @name set -* @memberof ndarray.prototype -* @type {Function} -* @param {...integer} [idx] - indices -* @param {*} v - value to set -* @returns {ndarray} ndarray instance -* -* @example -* var buffer = [ 1, 2, 3, 4, 5, 6 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -* -* var v = x.get( 1, 1 ); -* // returns 4 -* -* x.set( 1, 1, 10 ); -* -* var b = x.data; -* // returns [ 1, 2, 3, 10, 5, 6 ] -* -* v = x.get( 1, 1 ); -* // returns 10 -*/ -setReadOnly( ndarray.prototype, 'set', set ); - -/** -* Sets an array element located at a specified linear index. -* -* ## Notes -* -* - For zero-dimensional arrays, the first, and only, argument should be the value to set. -* -* @name iset -* @memberof ndarray.prototype -* @type {Function} -* @param {integer} [idx] - linear index -* @param {*} v - value to set -* @returns {ndarray} ndarray instance -* -* @example -* var buffer = [ 1, 2, 3, 4, 5, 6 ]; -* var shape = [ 3, 2 ]; -* var strides = [ 2, 1 ]; -* var offset = 0; -* -* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' ); -* -* var v = x.iget( 3 ); -* // returns 4 -* -* x.iset( 3, 10 ); -* -* var b = x.data; -* // returns [ 1, 2, 3, 10, 5, 6 ] -* -* v = x.iget( 3 ); -* // returns 10 -*/ -setReadOnly( ndarray.prototype, 'iset', iset ); - - -// EXPORTS // - -module.exports = ndarray; diff --git a/lib/set.js b/lib/set.js deleted file mode 100644 index e15e187..0000000 --- a/lib/set.js +++ /dev/null @@ -1,80 +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. -*/ - -/* eslint-disable no-invalid-this */ - -'use strict'; - -// MODULES // - -var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive; -var getIndex = require( '@stdlib/ndarray-base-ind' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Sets an array element. -* -* ## Notes -* -* - The number of indices should **equal** the number of dimensions. Accordingly, for zero-dimensional arrays, no indices should be provided. -* -* @private -* @param {...integer} [idx] - indices -* @param {*} v - value to set -* @throws {Error} cannot write to a read-only array -* @throws {TypeError} provided indices must be integer valued -* @throws {RangeError} index exceeds array dimensions -* @throws {RangeError} number of indices must equal the number of dimensions -* @returns {ndarray} ndarray instance -*/ -function set() { - var idx; - var ind; - var M; - var i; - - if ( this._flags.READONLY ) { - throw new Error( 'invalid invocation. Cannot write to a read-only array.' ); - } - if ( arguments.length !== this._ndims+1 ) { - throw new RangeError( format( 'invalid arguments. Number of indices must match the number of dimensions. ndims: `%u`. nargs: `%u`.', this._ndims, arguments.length ) ); - } - idx = this._offset; - M = this._submode.length; - for ( i = 0; i < arguments.length-1; i++ ) { - if ( !isInteger( arguments[ i ] ) ) { - throw new TypeError( format( 'invalid argument. Indices must be integer valued. Argument: `%i`. Value: `%s`.', i, arguments[ i ] ) ); - } - ind = getIndex( arguments[ i ], this._shape[ i ]-1, this._submode[ i%M ] ); // eslint-disable-line max-len - idx += this._strides[ i ] * ind; - } - if ( this._accessors ) { - this._buffer.set( arguments[ i ], idx ); - } else { - this._buffer[ idx ] = arguments[ i ]; - } - return this; -} - - -// EXPORTS // - -module.exports = set; diff --git a/lib/validate.js b/lib/validate.js deleted file mode 100644 index 5927ec4..0000000 --- a/lib/validate.js +++ /dev/null @@ -1,93 +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 isObject = require( '@stdlib/assert-is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' ); -var isIndexMode = require( '@stdlib/ndarray-base-assert-is-index-mode' ); -var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive; -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - function options -* @param {string} [options.mode] - specifies how to handle indices which exceed array dimensions -* @param {StringArray} [options.submode] - specifies how to handle subscripts which exceed array dimensions -* @param {boolean} [options.readonly] - boolean indicating whether an array should be read-only -* @returns {(Error|null)} null or an error object -* -* @example -* var opts = {}; -* var options = { -* 'mode': 'clamp', -* 'submode': [ 'throw', 'wrap', 'clamp' ] -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - var i; - if ( !isObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isIndexMode( opts.mode ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a recognized mode. Option: `%s`.', 'mode', opts.mode ) ); - } - } - if ( hasOwnProp( options, 'submode' ) ) { - opts.submode = options.submode; - if ( !isArrayLikeObject( opts.submode ) ) { - return new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode ) ); - } - if ( opts.submode.length === 0 ) { - return new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode.join( ',' ) ) ); - } - for ( i = 0; i < opts.submode.length; i++ ) { - if ( !isIndexMode( opts.submode[ i ] ) ) { - return new TypeError( format( 'invalid option. Each submode must be a recognized mode. Option: `%s`.', opts.submode[ i ] ) ); - } - } - opts.submode = opts.submode.slice(); - } - if ( hasOwnProp( options, 'readonly' ) ) { - opts.readonly = options.readonly; - if ( !isBoolean( opts.readonly ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', opts.readonly ) ); - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 3268cb7..0000000 --- a/manifest.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "options": {}, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "src": [ - "./src/get.c", - "./src/get_ptr.c", - "./src/iget.c", - "./src/iget_ptr.c", - "./src/iset.c", - "./src/main.c", - "./src/set.c", - "./src/set_ptr.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float32-ctor", - "@stdlib/complex-float64-ctor", - "@stdlib/ndarray-base-bytes-per-element", - "@stdlib/ndarray-base-dtype-char", - "@stdlib/ndarray-base-ind", - "@stdlib/ndarray-base-iteration-order", - "@stdlib/ndarray-base-minmax-view-buffer-index", - "@stdlib/ndarray-base-numel", - "@stdlib/ndarray-base-strides2order", - "@stdlib/ndarray-dtypes", - "@stdlib/ndarray-index-modes", - "@stdlib/ndarray-orders" - ] - } - ] -} diff --git a/package.json b/package.json index 4407706..fbc114b 100644 --- a/package.json +++ b/package.json @@ -3,33 +3,7 @@ "version": "0.2.2", "description": "Multidimensional array constructor.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "main": "./index.js", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -38,73 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-has-own-property": "^0.2.2", - "@stdlib/assert-is-array-like-object": "^0.2.2", - "@stdlib/assert-is-boolean": "^0.2.2", - "@stdlib/assert-is-collection": "^0.2.2", - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/assert-is-integer": "^0.2.2", - "@stdlib/assert-is-integer-array": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer": "^0.2.2", - "@stdlib/assert-is-nonnegative-integer-array": "^0.2.2", - "@stdlib/assert-is-plain-object": "^0.2.2", - "@stdlib/complex-float32-ctor": "^0.0.2", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/ndarray-base-assert-is-buffer-length-compatible": "^0.1.2", - "@stdlib/ndarray-base-assert-is-data-type": "^0.2.2", - "@stdlib/ndarray-base-assert-is-index-mode": "^0.2.2", - "@stdlib/ndarray-base-assert-is-order": "^0.2.2", - "@stdlib/ndarray-base-bytes-per-element": "^0.2.2", - "@stdlib/ndarray-base-ctor": "^0.2.2", - "@stdlib/ndarray-base-dtype-char": "^0.2.2", - "@stdlib/ndarray-base-ind": "^0.2.2", - "@stdlib/ndarray-base-iteration-order": "^0.2.2", - "@stdlib/ndarray-base-minmax-view-buffer-index": "^0.2.2", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/ndarray-base-strides2order": "^0.2.2", - "@stdlib/ndarray-defaults": "^0.3.0", - "@stdlib/ndarray-dtypes": "^0.3.0", - "@stdlib/ndarray-index-modes": "^0.2.2", - "@stdlib/ndarray-orders": "^0.2.2", - "@stdlib/string-format": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2", - "@stdlib/utils-inherit": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float32": "^0.2.2", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-has-property": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-array": "^0.2.2", - "@stdlib/assert-is-positive-integer": "^0.2.2", - "@stdlib/complex-float32-imag": "^0.1.1", - "@stdlib/complex-float32-real": "^0.1.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -125,7 +32,6 @@ "ctor", "numpy.ndarray" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" diff --git a/src/get.c b/src/get.c deleted file mode 100644 index f40084c..0000000 --- a/src/get.c +++ /dev/null @@ -1,320 +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/get.h" -#include "stdlib/ndarray/ctor/get_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -/** -* Returns an ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get( const struct ndarray *arr, const int64_t *sub, void *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_value( arr, idx, out ); -} - -/** -* Returns a double-precision floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_float64( const struct ndarray *arr, const int64_t *sub, double *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_float64( idx, out ); -} - -/** -* Returns a single-precision floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_float32( const struct ndarray *arr, const int64_t *sub, float *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_float32( idx, out ); -} - -/** -* Returns an unsigned 64-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_uint64( const struct ndarray *arr, const int64_t *sub, uint64_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint64( idx, out ); -} - -/** -* Returns a signed 64-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_int64( const struct ndarray *arr, const int64_t *sub, int64_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int64( idx, out ); -} - -/** -* Returns an unsigned 32-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_uint32( const struct ndarray *arr, const int64_t *sub, uint32_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint32( idx, out ); -} - -/** -* Returns a signed 32-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_int32( const struct ndarray *arr, const int64_t *sub, int32_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int32( idx, out ); -} - -/** -* Returns an unsigned 16-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_uint16( const struct ndarray *arr, const int64_t *sub, uint16_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint16( idx, out ); -} - -/** -* Returns a signed 16-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_int16( const struct ndarray *arr, const int64_t *sub, int16_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int16( idx, out ); -} - -/** -* Returns an unsigned 8-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_uint8( const struct ndarray *arr, const int64_t *sub, uint8_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint8( idx, out ); -} - -/** -* Returns a signed 8-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_int8( const struct ndarray *arr, const int64_t *sub, int8_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int8( idx, out ); -} - -/** -* Returns a double-precision complex floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_complex128( const struct ndarray *arr, const int64_t *sub, stdlib_complex128_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_complex128( idx, out ); -} - -/** -* Returns a single-precision complex floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_complex64( const struct ndarray *arr, const int64_t *sub, stdlib_complex64_t *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_complex64( idx, out ); -} - -/** -* Returns a boolean ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_bool( const struct ndarray *arr, const int64_t *sub, bool *out ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_bool( idx, out ); -} diff --git a/src/get_ptr.c b/src/get_ptr.c deleted file mode 100644 index ea52e4d..0000000 --- a/src/get_ptr.c +++ /dev/null @@ -1,344 +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/get_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/base/ind.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -/** -* Returns a pointer to an ndarray data element in the underlying byte array. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @return underlying byte array pointer -*/ -uint8_t * stdlib_ndarray_get_ptr( const struct ndarray *arr, const int64_t *sub ) { - int8_t *submodes; - int64_t *strides; - int64_t *shape; - int64_t ndims; - uint8_t *idx; - int64_t ind; - int64_t M; - int64_t i; - - ndims = arr->ndims; - shape = arr->shape; - strides = arr->strides; - submodes = arr->submodes; - M = arr->nsubmodes; - - idx = (arr->data) + (arr->offset); // pointer arithmetic - for ( i = 0; i < ndims; i++ ) { - ind = stdlib_ndarray_ind( sub[ i ], shape[ i ]-1, submodes[ i%M ] ); - if ( ind < 0 ) { - return NULL; - } - idx += strides[ i ] * ind; // pointer arithmetic - } - return idx; -} - -/** -* Returns an ndarray data element specified by a byte array pointer. -* -* ## 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. -* -* @param arr input ndarray -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_value( const struct ndarray *arr, const uint8_t *idx, void *out ) { - switch ( arr->dtype ) { - case STDLIB_NDARRAY_FLOAT64: - *(double *)out = *(double *)idx; - return 0; - case STDLIB_NDARRAY_FLOAT32: - *(float *)out = *(float *)idx; - return 0; - case STDLIB_NDARRAY_UINT64: - *(uint64_t *)out = *(uint64_t *)idx; - return 0; - case STDLIB_NDARRAY_INT64: - *(int64_t *)out = *(int64_t *)idx; - return 0; - case STDLIB_NDARRAY_UINT32: - *(uint32_t *)out = *(uint32_t *)idx; - return 0; - case STDLIB_NDARRAY_INT32: - *(int32_t *)out = *(int32_t *)idx; - return 0; - case STDLIB_NDARRAY_UINT16: - *(uint16_t *)out = *(uint16_t *)idx; - return 0; - case STDLIB_NDARRAY_INT16: - *(int16_t *)out = *(int16_t *)idx; - return 0; - case STDLIB_NDARRAY_UINT8: - *(uint8_t *)out = *(uint8_t *)idx; - return 0; - case STDLIB_NDARRAY_UINT8C: - *(uint8_t *)out = *(uint8_t *)idx; - return 0; - case STDLIB_NDARRAY_INT8: - *(int8_t *)out = *(int8_t *)idx; - return 0; - case STDLIB_NDARRAY_COMPLEX128: - *(stdlib_complex128_t *)out = *(stdlib_complex128_t *)idx; - return 0; - case STDLIB_NDARRAY_COMPLEX64: - *(stdlib_complex64_t *)out = *(stdlib_complex64_t *)idx; - return 0; - case STDLIB_NDARRAY_BOOL: - *(bool *)out = *(bool *)idx; - return 0; - default: - return -1; - } -} - -/** -* Returns a double-precision floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_float64( const uint8_t *idx, double *out ) { - *out = *(double *)idx; - return 0; -} - -/** -* Returns a single-precision floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_float32( const uint8_t *idx, float *out ) { - *out = *(float *)idx; - return 0; -} - -/** -* Returns an unsigned 64-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_uint64( const uint8_t *idx, uint64_t *out ) { - *out = *(uint64_t *)idx; - return 0; -} - -/** -* Returns a signed 64-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_int64( const uint8_t *idx, int64_t *out ) { - *out = *(int64_t *)idx; - return 0; -} - -/** -* Returns an unsigned 32-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_uint32( const uint8_t *idx, uint32_t *out ) { - *out = *(uint32_t *)idx; - return 0; -} - -/** -* Returns a signed 32-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_int32( const uint8_t *idx, int32_t *out ) { - *out = *(int32_t *)idx; - return 0; -} - -/** -* Returns an unsigned 16-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_uint16( const uint8_t *idx, uint16_t *out ) { - *out = *(uint16_t *)idx; - return 0; -} - -/** -* Returns a signed 16-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_int16( const uint8_t *idx, int16_t *out ) { - *out = *(int16_t *)idx; - return 0; -} - -/** -* Returns an unsigned 8-bit integer ndarray data element specified by a byte array pointer. -* -* ## Notes -* -* - The function always returns `0`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_uint8( const uint8_t *idx, uint8_t *out ) { - *out = *(uint8_t *)idx; - return 0; -} - -/** -* Returns a signed 8-bit integer ndarray data element specified by a byte array pointer. -* -* ## Notes -* -* - The function always returns `0`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_int8( const uint8_t *idx, int8_t *out ) { - *out = *(int8_t *)idx; - return 0; -} - -/** -* Returns a double-precision complex floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_complex128( const uint8_t *idx, stdlib_complex128_t *out ) { - *out = *(stdlib_complex128_t *)idx; - return 0; -} - -/** -* Returns a single-precision complex floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_complex64( const uint8_t *idx, stdlib_complex64_t *out ) { - *out = *(stdlib_complex64_t *)idx; - return 0; -} - -/** -* Returns a boolean ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_get_ptr_bool( const uint8_t *idx, bool *out ) { - *out = *(bool *)idx; - return 0; -} diff --git a/src/iget.c b/src/iget.c deleted file mode 100644 index 4ce3811..0000000 --- a/src/iget.c +++ /dev/null @@ -1,336 +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/iget.h" -#include "stdlib/ndarray/ctor/iget_ptr.h" -#include "stdlib/ndarray/ctor/get_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -/** -* Returns an ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget( const struct ndarray *arr, const int64_t idx, void *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_value( arr, ptr, out ); -} - -/** -* Returns a double-precision floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_float64( const struct ndarray *arr, const int64_t idx, double *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_float64( ptr, out ); -} - -/** -* Returns a single-precision floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_float32( const struct ndarray *arr, const int64_t idx, float *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_float32( ptr, out ); -} - -/** -* Returns an unsigned 64-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_uint64( const struct ndarray *arr, const int64_t idx, uint64_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint64( ptr, out ); -} - -/** -* Returns a signed 64-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_int64( const struct ndarray *arr, const int64_t idx, int64_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int64( ptr, out ); -} - -/** -* Returns an unsigned 32-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_uint32( const struct ndarray *arr, const int64_t idx, uint32_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint32( ptr, out ); -} - -/** -* Returns a signed 32-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_int32( const struct ndarray *arr, const int64_t idx, int32_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int32( ptr, out ); -} - -/** -* Returns an unsigned 16-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_uint16( const struct ndarray *arr, const int64_t idx, uint16_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint16( ptr, out ); -} - -/** -* Returns a signed 16-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_int16( const struct ndarray *arr, const int64_t idx, int16_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int16( ptr, out ); -} - -/** -* Returns an unsigned 8-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_uint8( const struct ndarray *arr, const int64_t idx, uint8_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_uint8( ptr, out ); -} - -/** -* Returns a signed 8-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_int8( const struct ndarray *arr, const int64_t idx, int8_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_int8( ptr, out ); -} - -/** -* Returns a double-precision complex floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_complex128( const struct ndarray *arr, const int64_t idx, stdlib_complex128_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_complex128( ptr, out ); -} - -/** -* Returns a single-precision complex floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_complex64( const struct ndarray *arr, const int64_t idx, stdlib_complex64_t *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_complex64( ptr, out ); -} - -/** -* Returns a boolean ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param out output address -* @return status code -*/ -int8_t stdlib_ndarray_iget_bool( const struct ndarray *arr, const int64_t idx, bool *out ) { - uint8_t *ptr = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ptr == NULL ) { - return -1; - } - return stdlib_ndarray_get_ptr_bool( ptr, out ); -} diff --git a/src/iget_ptr.c b/src/iget_ptr.c deleted file mode 100644 index d34e4b7..0000000 --- a/src/iget_ptr.c +++ /dev/null @@ -1,102 +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/iget_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/ndarray/ctor/macros.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/base/ind.h" -#include "stdlib/ndarray/base/iteration_order.h" -#include -#include - -/** -* Returns a pointer in the underlying byte array for an ndarray data element located at a specified linear index. -* -* ## Notes -* -* - For zero-dimensional arrays, the function returns a pointer to the first (and only) indexed element, regardless of the value of `idx`. -* -* @param arr input ndarray -* @param idx linear view index -* @return underlying byte array pointer -*/ -uint8_t * stdlib_ndarray_iget_ptr( const struct ndarray *arr, const int64_t idx ) { - int64_t *strides; - int64_t *shape; - int64_t ndims; - uint8_t *ind; - int64_t s; - int64_t i; - int64_t j; - int8_t io; - - // Retrieve the number of dimensions - ndims = arr->ndims; - - // For zero-dimensional ndarrays, we ignore the index argument and return a pointer to the first (and only) indexed element... - if ( ndims == 0 ) { - return (arr->data) + (arr->offset); // pointer arithmetic - } - // Copy index argument to a mutable variable: - j = idx; - - // Resolve an ndarray index based on the ndarray index mode: - j = stdlib_ndarray_ind( j, (arr->length)-1, arr->imode ); - if ( j < 0 ) { - return NULL; - } - // Determine the pointer to the first indexed element: - ind = (arr->data) + (arr->offset); // pointer arithmetic - - // Determine the iteration order based on the ndarray strides: - strides = arr->strides; - io = stdlib_ndarray_iteration_order( ndims, strides ); - - // Check for trivial case... - if ( (arr->flags) & (STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG | STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG) ) { - // Trivial case where we have all positive strides... - if ( io == 1 ) { - return ind + (j*(arr->BYTES_PER_ELEMENT)); // pointer arithmetic - } - // Trivial case where we have all negative strides... - if ( io == -1 ) { - return ind - (j*(arr->BYTES_PER_ELEMENT)); // pointer arithmetic - } - } - // The approach which follows is to resolve a view index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the underlying byte array... - shape = arr->shape; - if ( (arr->order) == STDLIB_NDARRAY_COLUMN_MAJOR ) { - for ( i = 0; i < ndims; i++ ) { - s = j % shape[ i ]; - j -= s; - j /= shape[ i ]; - ind += s * strides[ i ]; // pointer arithmetic - } - return ind; - } - // Case: row-major - for ( i = ndims-1; i >= 0; i-- ) { - s = j % shape[ i ]; - j -= s; - j /= shape[ i ]; - ind += s * strides[ i ]; // pointer arithmetic - } - return ind; -} diff --git a/src/iset.c b/src/iset.c deleted file mode 100644 index 7c078b3..0000000 --- a/src/iset.c +++ /dev/null @@ -1,334 +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/iset.h" -#include "stdlib/ndarray/ctor/iget_ptr.h" -#include "stdlib/ndarray/ctor/set_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -/** -* Sets an ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset( const struct ndarray *arr, const int64_t idx, const void *v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_value( arr, ind, v ); -} - -/** -* Sets a double-precision floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_float64( const struct ndarray *arr, const int64_t idx, const double v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_float64( ind, v ); -} - -/** -* Sets a single-precision floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_float32( const struct ndarray *arr, const int64_t idx, const float v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_float32( ind, v ); -} - -/** -* Sets an unsigned 64-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_uint64( const struct ndarray *arr, const int64_t idx, const uint64_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint64( ind, v ); -} - -/** -* Sets a signed 64-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_int64( const struct ndarray *arr, const int64_t idx, const int64_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int64( ind, v ); -} - -/** -* Sets an unsigned 32-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_uint32( const struct ndarray *arr, const int64_t idx, const uint32_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint32( ind, v ); -} - -/** -* Sets a signed 32-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_int32( const struct ndarray *arr, const int64_t idx, const int32_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int32( ind, v ); -} - -/** -* Sets an unsigned 16-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_uint16( const struct ndarray *arr, const int64_t idx, const uint16_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint16( ind, v ); -} - -/** -* Sets a signed 16-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_int16( const struct ndarray *arr, const int64_t idx, const int16_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int16( ind, v ); -} - -/** -* Sets an unsigned 8-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_uint8( const struct ndarray *arr, const int64_t idx, const uint8_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint8( ind, v ); -} - -/** -* Sets a signed 8-bit integer ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_int8( const struct ndarray *arr, const int64_t idx, const int8_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int8( ind, v ); -} - -/** -* Sets a double-precision complex floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_complex128( const struct ndarray *arr, const int64_t idx, const stdlib_complex128_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_complex128( ind, v ); -} - -/** -* Sets a single-precision complex floating-point ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_complex64( const struct ndarray *arr, const int64_t idx, const stdlib_complex64_t v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_complex64( ind, v ); -} - -/** -* Sets a boolean ndarray data element located at a specified linear index. -* -* ## 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`. -* -* @param arr input ndarray -* @param idx linear view index -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_iset_bool( const struct ndarray *arr, const int64_t idx, const bool v ) { - uint8_t *ind = stdlib_ndarray_iget_ptr( arr, idx ); - if ( ind == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_bool( ind, v ); -} diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 08f977d..0000000 --- a/src/main.c +++ /dev/null @@ -1,440 +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/base/bytes_per_element.h" -#include "stdlib/ndarray/base/iteration_order.h" -#include "stdlib/ndarray/base/minmax_view_buffer_index.h" -#include "stdlib/ndarray/base/numel.h" -#include "stdlib/ndarray/base/strides2order.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include -#include - -// NOTE: keep functions in alphabetical order... - -/** -* Returns a pointer to a dynamically allocated ndarray. -* -* ## Notes -* -* - The user is responsible for freeing the allocated memory. -* -* - To create a zero-dimensional array, -* -* - provide an `ndims` argument equal to `0`. -* - a `shape` argument equal to a null pointer. -* - a `strides` argument containing 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. -* -* ```javascript -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include -* -* uint8_t buffer[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* int64_t *shape = NULL; -* int64_t strides = { 0 }; -* int64_t offset = 0; -* -* struct ndarray *x = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, buffer, 0, shape, strides, offset, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, { STDLIB_NDARRAY_INDEX_ERROR } ); -* ``` -* -* @param dtype data type -* @param data pointer to the underlying byte array -* @param ndims number of dimensions -* @param shape array shape (dimensions) -* @param strides array strides (in bytes) -* @param offset byte offset specifying the location of the first element -* @param order specifies whether an array is row-major (C-style) or column-major (Fortran-style) -* @param imode specifies how to handle indices which exceed array dimensions -* @param nsubmodes number of subscript modes -* @param submodes specifies how to handle subscripts which exceed array dimensions on a per dimension basis (if provided fewer submodes than dimensions, submodes are recycled using modulo arithmetic) -* @return pointer to a dynamically allocated ndarray or, if unable to allocate memory, a null pointer -* -* @example -* #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 ); -*/ -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 ) { - int64_t len; - - struct ndarray *arr = malloc( sizeof( struct ndarray ) ); - if ( arr == NULL ) { - return NULL; - } - arr->data = data; - arr->dtype = dtype; - arr->imode = imode; - arr->ndims = ndims; - arr->nsubmodes = nsubmodes; - arr->offset = offset; - arr->order = order; - arr->shape = shape; - arr->strides = strides; - arr->submodes = submodes; - - if ( shape == NULL ) { - len = 1; - } else { - len = stdlib_ndarray_numel( ndims, shape ); - } - arr->length = len; - - arr->BYTES_PER_ELEMENT = stdlib_ndarray_bytes_per_element( dtype ); - arr->byteLength = len * (arr->BYTES_PER_ELEMENT); - arr->flags = stdlib_ndarray_flags( arr ); - - return arr; -} - -/** -* Returns the size of an ndarray (in bytes). -* -* @param arr input ndarray -* @return array size -*/ -int64_t stdlib_ndarray_bytelength( const struct ndarray *arr ) { - return arr->byteLength; -} - -/** -* Returns a pointer to an ndarray's underlying byte array. -* -* @param arr input ndarray -* @return underlying byte array -*/ -uint8_t * stdlib_ndarray_data( const struct ndarray *arr ) { - return arr->data; -} - -/** -* Returns an ndarray dimension size. -* -* ## Notes -* -* - The function does not perform any sanity checks. -* - If an input ndarray is zero-dimensional, the function always returns `-1`. -* -* @param arr input ndarray -* @param i dimension index -* @return dimension size -*/ -int64_t stdlib_ndarray_dimension( const struct ndarray *arr, const int64_t i ) { - if ( arr->shape == NULL ) { - return -1; - } - return arr->shape[ i ]; -} - -/** -* Disables specified ndarray flags. -* -* ## Notes -* -* - The function does not perform any sanity checks and **assumes** the user knows what s/he is doing. -* -* @param arr input ndarray -* @param flags bit mask to disable flags -* @return status code -*/ -int8_t stdlib_ndarray_disable_flags( struct ndarray *arr, const int64_t flags ) { - arr->flags &= ~flags; - return 0; -} - -/** -* Returns an ndarray data type. -* -* @param arr input ndarray -* @return array data type -*/ -int16_t stdlib_ndarray_dtype( const struct ndarray *arr ) { - return arr->dtype; -} - -/** -* Enables specified ndarray flags. -* -* ## Notes -* -* - The function does not perform any sanity checks and **assumes** the user knows what s/he is doing. -* -* @param arr input ndarray -* @param flags bit mask to enable flags -* @return status code -*/ -int8_t stdlib_ndarray_enable_flags( struct ndarray *arr, const int64_t flags ) { - arr->flags |= flags; - return 0; -} - -/** -* Returns ndarray flags. -* -* @param arr input ndarray -* @return flags -*/ -int64_t stdlib_ndarray_flags( const struct ndarray *arr ) { - uint8_t contiguous; - int64_t *strides; - int64_t nbytes; - int64_t tmp[2]; - int64_t ndims; - int64_t flags; - int64_t len; - int8_t ord; - - // Cache various ndarray data: - len = arr->length; - ndims = arr->ndims; - strides = arr->strides; - nbytes = arr->BYTES_PER_ELEMENT; - - // Initialize the memory for `flags`: - flags = 0; - - // Determine if the array can be stored contiguously... - if ( len == 0 || stdlib_ndarray_iteration_order( ndims, strides ) == 0 ) { - // If an array does not contain any elements, then no data to store, and, if the array is unordered, adjacent array elements are not guaranteed to be stored next to each other: - contiguous = 0; - } else if ( ndims == 0 ) { - // If an array is zero-dimensional, data consists of a single element which means it is trivially compatible with a single memory segment: - contiguous = 1; - } else { - // Ensure that the array is compatible with a single memory segment: - stdlib_ndarray_minmax_view_buffer_index( ndims, arr->shape, strides, arr->offset, tmp ); - if ( (len*nbytes) == ( (tmp[1]-tmp[0])+nbytes ) ) { - // Compatible: - contiguous = 1; - } else { - // Incompatible: - contiguous = 0; - } - } - // Determine if the array is row-major/column-major contiguous: - if ( contiguous == 1 ) { - // Infer the array "order" from the stride array (this is supplementary to `arr->order`): - ord = stdlib_ndarray_strides2order( ndims, strides ); - - if ( ord == 1 || ord == 3 ) { - flags |= STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG; - } - if ( ord == 2 || ord == 3 ) { - flags |= STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG; - } - } - return flags; -} - -/** -* Frees an ndarray's allocated memory. -* -* @param arr input ndarray -*/ -void stdlib_ndarray_free( struct ndarray *arr ) { - free( arr ); -} - -/** -* Tests whether an ndarray has specified flags enabled. -* -* @param arr input ndarray -* @param flags bit mask specifying the flags to test against -* @return `1` if flags are set and `0` otherwise -*/ -int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags ) { - if ( ( arr->flags & flags ) == flags ) { - return 1; - } - return 0; -} - -/** -* Returns the index mode of an ndarray. -* -* @param arr input ndarray -* @return index mode -*/ -int8_t stdlib_ndarray_index_mode( const struct ndarray *arr ) { - return arr->imode; -} - -/** -* Returns the number of elements in an ndarray. -* -* @param arr input ndarray -* @return number of elements -*/ -int64_t stdlib_ndarray_length( const struct ndarray *arr ) { - return arr->length; -} - -/** -* Returns the number of ndarray dimensions. -* -* @param arr input ndarray -* @return number of dimensions -*/ -int64_t stdlib_ndarray_ndims( const struct ndarray *arr ) { - return arr->ndims; -} - -/** -* Returns the number of ndarray subscript modes. -* -* @param arr input ndarray -* @return number of subscript modes -*/ -int64_t stdlib_ndarray_nsubmodes( const struct ndarray *arr ) { - return arr->nsubmodes; -} - -/** -* Returns an ndarray index offset (in bytes). -* -* @param arr input ndarray -* @return array strides -*/ -int64_t stdlib_ndarray_offset( const struct ndarray *arr ) { - return arr->offset; -} - -/** -* Returns the order of an ndarray. -* -* @param arr input ndarray -* @return array order -*/ -int8_t stdlib_ndarray_order( const struct ndarray *arr ) { - return arr->order; -} - -/** -* Returns a pointer to an array containing an ndarray shape (dimensions). -* -* ## Notes -* -* - If an input ndarray is zero-dimensional, the function returns a null pointer. -* -* @param arr input ndarray -* @return array shape (dimensions) -*/ -int64_t * stdlib_ndarray_shape( const struct ndarray *arr ) { - return arr->shape; -} - -/** -* Returns an ndarray stride (in bytes). -* -* ## Notes -* -* - The function does not perform any sanity checks. -* -* @param arr input ndarray -* @param i dimension index -* @return array stride -*/ -int64_t stdlib_ndarray_stride( const struct ndarray *arr, const int64_t i ) { - return arr->strides[ i ]; -} - -/** -* Returns a pointer to an array containing ndarray strides (in bytes). -* -* @param arr input ndarray -* @return array strides -*/ -int64_t * stdlib_ndarray_strides( const struct ndarray *arr ) { - return arr->strides; -} - -/** -* Returns an ndarray subscript mode. -* -* ## Notes -* -* - If an ndarray has fewer subscript modes than dimensions, modes are recycled using modulo arithmetic. -* - The function does not perform any sanity checks. -* -* @param arr input ndarray -* @param i dimension index -* @return subscript mode -*/ -int8_t stdlib_ndarray_submode( const struct ndarray *arr, const int64_t i ) { - return arr->submodes[ i%(arr->nsubmodes) ]; -} - -/** -* Returns ndarray subscript modes. -* -* @param arr input ndarray -* @return subscript modes -*/ -int8_t * stdlib_ndarray_submodes( const struct ndarray *arr ) { - return arr->submodes; -} diff --git a/src/set.c b/src/set.c deleted file mode 100644 index 402c5b1..0000000 --- a/src/set.c +++ /dev/null @@ -1,320 +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/set.h" -#include "stdlib/ndarray/ctor/set_ptr.h" -#include "stdlib/ndarray/ctor/get_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -/** -* Sets an ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set( const struct ndarray *arr, const int64_t *sub, const void *v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_value( arr, idx, v ); -} - -/** -* Sets a double-precision floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_float64( const struct ndarray *arr, const int64_t *sub, const double v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_float64( idx, v ); -} - -/** -* Sets a single-precision floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_float32( const struct ndarray *arr, const int64_t *sub, const float v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_float32( idx, v ); -} - -/** -* Sets an unsigned 64-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_uint64( const struct ndarray *arr, const int64_t *sub, const uint64_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint64( idx, v ); -} - -/** -* Sets a signed 64-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_int64( const struct ndarray *arr, const int64_t *sub, const int64_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int64( idx, v ); -} - -/** -* Sets an unsigned 32-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_uint32( const struct ndarray *arr, const int64_t *sub, const uint32_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint32( idx, v ); -} - -/** -* Sets a signed 32-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_int32( const struct ndarray *arr, const int64_t *sub, const int32_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int32( idx, v ); -} - -/** -* Sets an unsigned 16-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_uint16( const struct ndarray *arr, const int64_t *sub, const uint16_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint16( idx, v ); -} - -/** -* Sets a signed 16-bit integer ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_int16( const struct ndarray *arr, const int64_t *sub, const int16_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int16( idx, v ); -} - -/** -* Sets an unsigned 8-bit integer ndarray data element. -* -* ## Notes -* -* - The function returns `-1` if unable to set an element and `0` otherwise. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_uint8( const struct ndarray *arr, const int64_t *sub, const uint8_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_uint8( idx, v ); -} - -/** -* Sets a signed 8-bit integer ndarray data element. -* -* ## Notes -* -* - The function returns `-1` if unable to set an element and `0` otherwise. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_int8( const struct ndarray *arr, const int64_t *sub, const int8_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_int8( idx, v ); -} - -/** -* Sets a double-precision complex floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_complex128( const struct ndarray *arr, const int64_t *sub, const stdlib_complex128_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_complex128( idx, v ); -} - -/** -* Sets a single-precision complex floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_complex64( const struct ndarray *arr, const int64_t *sub, const stdlib_complex64_t v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_complex64( idx, v ); -} - -/** -* Sets a boolean floating-point ndarray data element. -* -* ## 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. -* -* @param arr input ndarray -* @param sub ndarray subscripts -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_bool( const struct ndarray *arr, const int64_t *sub, const bool v ) { - uint8_t *idx = stdlib_ndarray_get_ptr( arr, sub ); - if ( idx == NULL ) { - return -1; - } - return stdlib_ndarray_set_ptr_bool( idx, v ); -} diff --git a/src/set_ptr.c b/src/set_ptr.c deleted file mode 100644 index f2581bb..0000000 --- a/src/set_ptr.c +++ /dev/null @@ -1,307 +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/set_ptr.h" -#include "stdlib/ndarray/ctor/ndarray.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include - -/** -* Sets an ndarray data element specified by a byte array pointer. -* -* ## 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. -* -* @param arr input ndarray -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_value( const struct ndarray *arr, uint8_t *idx, const void *v ) { - switch ( arr->dtype ) { - case STDLIB_NDARRAY_FLOAT64: - *(double *)idx = *(double *)v; - return 0; - case STDLIB_NDARRAY_FLOAT32: - *(float *)idx = *(float *)v; - return 0; - case STDLIB_NDARRAY_UINT64: - *(uint64_t *)idx = *(uint64_t *)v; - return 0; - case STDLIB_NDARRAY_INT64: - *(int64_t *)idx = *(int64_t *)v; - return 0; - case STDLIB_NDARRAY_UINT32: - *(uint32_t *)idx = *(uint32_t *)v; - return 0; - case STDLIB_NDARRAY_INT32: - *(int32_t *)idx = *(int32_t *)v; - return 0; - case STDLIB_NDARRAY_UINT16: - *(uint16_t *)idx = *(uint16_t *)v; - return 0; - case STDLIB_NDARRAY_INT16: - *(int16_t *)idx = *(int16_t *)v; - return 0; - case STDLIB_NDARRAY_UINT8: - *(uint8_t *)idx = *(uint8_t *)v; - return 0; - case STDLIB_NDARRAY_UINT8C: - *(uint8_t *)idx = *(uint8_t *)v; - return 0; - case STDLIB_NDARRAY_INT8: - *(int8_t *)idx = *(int8_t *)v; - return 0; - case STDLIB_NDARRAY_COMPLEX128: - *(stdlib_complex128_t *)idx = *(stdlib_complex128_t *)v; - return 0; - case STDLIB_NDARRAY_COMPLEX64: - *(stdlib_complex64_t *)idx = *(stdlib_complex64_t *)v; - return 0; - case STDLIB_NDARRAY_BOOL: - *(bool *)idx = *(bool *)v; - return 0; - default: - return -1; - } -} - -/** -* Sets a double-precision floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_float64( uint8_t *idx, const double v ) { - *(double *)idx = v; - return 0; -} - -/** -* Sets a single-precision floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_float32( uint8_t *idx, const float v ) { - *(float *)idx = v; - return 0; -} - -/** -* Sets an unsigned 64-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_uint64( uint8_t *idx, const uint64_t v ) { - *(uint64_t *)idx = v; - return 0; -} - -/** -* Sets a signed 64-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_int64( uint8_t *idx, const int64_t v ) { - *(int64_t *)idx = v; - return 0; -} - -/** -* Sets an unsigned 32-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_uint32( uint8_t *idx, const uint32_t v ) { - *(uint32_t *)idx = v; - return 0; -} - -/** -* Sets a signed 32-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_int32( uint8_t *idx, const int32_t v ) { - *(int32_t *)idx = v; - return 0; -} - -/** -* Sets an unsigned 16-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_uint16( uint8_t *idx, const uint16_t v ) { - *(uint16_t *)idx = v; - return 0; -} - -/** -* Sets a signed 16-bit integer ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_int16( uint8_t *idx, const int16_t v ) { - *(int16_t *)idx = v; - return 0; -} - -/** -* Sets an unsigned 8-bit integer ndarray data element specified by a byte array pointer. -* -* ## Notes -* -* - The function always returns `0`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_uint8( uint8_t *idx, const uint8_t v ) { - *(uint8_t *)idx = v; - return 0; -} - -/** -* Sets a signed 8-bit integer ndarray data element specified by a byte array pointer. -* -* ## Notes -* -* - The function always returns `0`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_int8( uint8_t *idx, const int8_t v ) { - *(int8_t *)idx = v; - return 0; -} - -/** -* Sets a double-precision complex floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_complex128( uint8_t *idx, const stdlib_complex128_t v ) { - *(stdlib_complex128_t *)idx = v; - return 0; -} - -/** -* Sets a single-precision complex floating-point ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_complex64( uint8_t *idx, const stdlib_complex64_t v ) { - *(stdlib_complex64_t *)idx = v; - return 0; -} - -/** -* Sets a boolean ndarray data element specified by a byte array pointer. -* -* ## 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`. -* -* @param idx byte array pointer to an ndarray data element -* @param v value to set -* @return status code -*/ -int8_t stdlib_ndarray_set_ptr_bool( uint8_t *idx, const bool v ) { - *(bool *)idx = v; - return 0; -} diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 0000000..6032cf1 --- /dev/null +++ b/stats_browser.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/stats_node.html b/stats_node.html new file mode 100644 index 0000000..9cc29ad --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.argument_validation.js b/test/test.argument_validation.js deleted file mode 100644 index 5ee8493..0000000 --- a/test/test.argument_validation.js +++ /dev/null @@ -1,998 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the constructor throws an error if not provided a valid `dtype` argument', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var order; - var shape; - var i; - - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( value, buffer, shape, strides, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `dtype` argument (options)', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var order; - var shape; - var i; - - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( value, buffer, shape, strides, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `buffer` argument', function test( t ) { - var strides; - var values; - var offset; - var dtype; - var order; - var shape; - var i; - - dtype = 'generic'; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - { - 'length': 10, - 'get': function noop() {}, - 'set': true - }, - { - 'length': 10, - 'get': true, - 'set': function noop() {} - }, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, value, shape, strides, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `buffer` argument (options)', function test( t ) { - var strides; - var values; - var offset; - var dtype; - var order; - var shape; - var i; - - dtype = 'generic'; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - {}, - { - 'length': 10, - 'get': function noop() {}, - 'set': true - }, - { - 'length': 10, - 'get': true, - 'set': function noop() {} - }, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, value, shape, strides, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `shape` argument', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var order; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [ 1, 3.14 ], - [ -1, -2 ], - [ 1, '1' ], - [ 1, null ], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, value, strides, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `shape` argument (options)', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var order; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [ 1, 3.14 ], - [ -1, -2 ], - [ 1, '1' ], - [ 1, null ], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, value, strides, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if the number of ndarray dimensions may cause stack limits to be exceeded', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var order; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] ); - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - 1e5, - 1e6 - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var shape = new Float64Array( value ); - ndarray( dtype, buffer, shape, strides, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if the number of ndarray dimensions may cause stack limits to be exceeded (options)', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var order; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] ); - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - 1e5, - 1e6 - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var shape = new Float64Array( value ); - ndarray( dtype, buffer, shape, strides, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = [ 2, 2 ]; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - [ 1, 3.14 ], - [ -1, -3.14 ], - [ 1, '1' ], - [ 1, null ], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (0d)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = []; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - [ 1.1 ], - [ 1, 3.14 ], - [ -1, -3.14 ], - [ 1, '1' ], - [ 1, null ], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (0d)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = []; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - [ 1 ], - [ 2 ], - [ 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (options)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = [ 2, 2 ]; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - [ 1, 3.14 ], - [ -1, -3.14 ], - [ 1, '1' ], - [ 1, null ], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (options; 0d)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = []; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - [ 1.1 ], - [ 1, 3.14 ], - [ -1, -3.14 ], - [ 1, '1' ], - [ 1, null ], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (number of dimensions)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = [ 2, 2 ]; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - [ 1 ], - [ 4, 2, 1 ], - [ 4, 4, 2, 1 ], - [ 4, 4, 4, 2, 1 ], - [ 4, 4, 4, 4, 2, 1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (number of dimensions; 0d)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = []; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - [], - [ 2, 1 ], - [ 4, 2, 1 ], - [ 4, 4, 2, 1 ], - [ 4, 4, 4, 2, 1 ], - [ 4, 4, 4, 4, 2, 1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (number of dimensions; options)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = [ 2, 2 ]; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - [ 1 ], - [ 4, 2, 1 ], - [ 4, 4, 2, 1 ], - [ 4, 4, 4, 2, 1 ], - [ 4, 4, 4, 4, 2, 1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `strides` argument (number of dimensions; options; 0d)', function test( t ) { - var values; - var offset; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - shape = []; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - order = 'row-major'; - offset = 0; - - values = [ - [], - [ 2, 1 ], - [ 4, 2, 1 ], - [ 4, 4, 2, 1 ], - [ 4, 4, 4, 2, 1 ], - [ 4, 4, 4, 4, 2, 1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, value, offset, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `offset` argument', function test( t ) { - var strides; - var values; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - - values = [ - '5', - -5, - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, strides, value, order ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `offset` argument (options)', function test( t ) { - var strides; - var values; - var buffer; - var shape; - var dtype; - var order; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - - values = [ - '5', - -5, - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, strides, value, order, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `order` argument', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var shape; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - 'c', - 'f', - 'c-style', - 'fortran', - 'fortran-style', - 'row', - 'column', - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, strides, offset, value ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid `order` argument (options)', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var shape; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - 'c', - 'f', - 'c-style', - 'fortran', - 'fortran-style', - 'row', - 'column', - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, strides, offset, value, {} ); - }; - } -}); - -tape( 'the constructor throws an error if not provided a valid options argument', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var shape; - var order; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - strides = [ 2, 1 ]; - offset = 0; - order = 'row-major'; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray( dtype, buffer, shape, strides, offset, order, value ); - }; - } -}); - -tape( 'the constructor throws an error if provided an invalid option', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var dtype; - var shape; - var order; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - strides = [ 2, 1 ]; - offset = 0; - order = 'row-major'; - - values = [ - '5', - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var opts = { - 'mode': value - }; - ndarray( dtype, buffer, shape, strides, offset, order, opts ); - }; - } -}); - -tape( 'the constructor throws an error if not provided compatible input arguments', function test( t ) { - var strides; - var values; - var offset; - var buffer; - var order; - var dtype; - var shape; - var i; - - dtype = 'generic'; - buffer = [ 0.0, 1.0, 2.0, 3.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - values = [ - [ dtype, [ 0.0 ], shape, strides, offset, order ], - [ dtype, buffer, [ 3, 2 ], strides, offset, order ], - [ dtype, buffer, shape, [ 2, 2 ], offset, order ], - [ dtype, buffer, shape, strides, 2, order ], - [ dtype, buffer, shape, strides, 20, order ], - [ dtype, buffer, shape, [ 2, -1 ], offset, order ], - [ dtype, buffer, shape, [ -2, 1 ], offset, order ], - [ dtype, buffer, shape, [ -2, 1 ], 1, order ], - [ dtype, buffer, shape, [ -2, -1 ], offset, order ], - [ dtype, buffer, shape, [ -2, -1 ], 1, order ], - [ dtype, buffer, shape, [ -2, -1 ], 2, order ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + JSON.stringify( values[ i ] ) ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - ndarray.apply( null, value ); - }; - } -}); diff --git a/test/test.copy_array.js b/test/test.copy_array.js deleted file mode 100644 index 7259781..0000000 --- a/test/test.copy_array.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isArray = require( '@stdlib/assert-is-array' ); -var copy = require( './../lib/copy_array.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof copy, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function copies the elements of an array-like input value and returns an output array', function test( t ) { - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0 ]; - out = copy( arr, arr.length ); - - t.strictEqual( isArray( out ), true, 'returns an array' ); - t.notEqual( out, arr, 'returns a new instance' ); - t.deepEqual( arr, out, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function copies the elements of an array-like input value and returns an output array (>64K elements)', function test( t ) { - var arr; - var out; - var i; - - arr = []; - for ( i = 0; i < 1e6; i++ ) { - arr.push( i ); - } - out = copy( arr, arr.length ); - - t.strictEqual( isArray( out ), true, 'returns an array' ); - t.notEqual( out, arr, 'returns a new instance' ); - t.deepEqual( arr, out, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.get.js b/test/test.instance.get.js deleted file mode 100644 index f741422..0000000 --- a/test/test.instance.get.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'get' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'get' ), true, 'has property' ); - t.strictEqual( isFunction( arr.get ), true, 'has method' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'get' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'get' ), true, 'has property' ); - t.strictEqual( isFunction( arr.get ), true, 'has method' ); - t.end(); -}); diff --git a/test/test.instance.get_0d.js b/test/test.instance.get_0d.js deleted file mode 100644 index 481496f..0000000 --- a/test/test.instance.get_0d.js +++ /dev/null @@ -1,131 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method which throws an error if provided any arguments (0d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 0, - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get(), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element (0d; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get(); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.get_1d.js b/test/test.instance.get_1d.js deleted file mode 100644 index 7d126a2..0000000 --- a/test/test.instance.get_1d.js +++ /dev/null @@ -1,1221 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method which throws an error if not provided an integer value (1d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - v = arr.get( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - v = arr.get( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - v = arr.get( 3 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - v = arr.get( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - v = arr.get( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - v = arr.get( 3 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=wrap; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.get( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - v = arr.get( 4 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - v = arr.get( 5 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - v = arr.get( -2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - v = arr.get( -1 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=clamp; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.get( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - v = arr.get( 4 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - v = arr.get( 5 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - v = arr.get( -2 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - v = arr.get( -1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=throw; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.get( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -3 ), 2.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=normalize; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.get( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.get( -3 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -11 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -3 ), 2.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; submode=[normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -3 ), 2.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; submode=[normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -3 ), 2.0, 'returns expected value' ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; submode=[wrap,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; row-major; submode=[clamp,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (1d; column-major; submode=[clamp,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.get_2d.js b/test/test.instance.get_2d.js deleted file mode 100644 index d65c514..0000000 --- a/test/test.instance.get_2d.js +++ /dev/null @@ -1,1136 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method which throws an error if not provided an integer value (2d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ], 0 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 1 ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value, dim ) { - if ( dim === 0 ) { - return i; - } - return j; - - function i() { - arr.get( value, 0 ); - } - - function j() { - arr.get( 0, value ); - } - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0, 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.get( 0, 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.get( 1, 0 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.get( 1, 1 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0, 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.get( 0, 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.get( 1, 0 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.get( 1, 1 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 2, 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2, 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -2, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -2, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -20, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -20, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -2, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -2, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; submode=[clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 2, 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2, 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -2, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; submode=[throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'throw', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -2, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; submode=[normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( -2, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -20, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; submode=[normalize,normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'normalize', 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 4 ], - [ -20, -3 ], - [ 9, 10 ], - [ 3, 3 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; row-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 2, 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (2d; column-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, -3 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 9, 10 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 3, 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.get_3d.js b/test/test.instance.get_3d.js deleted file mode 100644 index 2e5b35e..0000000 --- a/test/test.instance.get_3d.js +++ /dev/null @@ -1,915 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method which throws an error if not provided an integer value (3d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ], 0 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 1 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 2 ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value, dim ) { - if ( dim === 0 ) { - return i; - } - if ( dim === 1 ) { - return j; - } - return k; - - function i() { - arr.get( value, 0, 0 ); - } - - function j() { - arr.get( 0, value, 0 ); - } - - function k() { - arr.get( 0, 0, value ); - } - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0, 0, 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.get( 0, 0, 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.get( 0, 1, 0 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.get( 0, 1, 1 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -3, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -20, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -3, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; submode=[clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; submode=[throw,throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'throw', 'throw', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -2, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; submode=[normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'row-major'; - strides = [ 3, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -3, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -20, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; submode=[normalize,normalize,normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'normalize', 'normalize', 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = [ 1, 3, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 3 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -3, 0 ), 1.0, 'returns expected value' ); - - values = [ - [ 2, 6, 100 ], - [ 0, -20, -4 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; row-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (3d; column-major; submode=[wrap,wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 2, 6, 100 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -2, -4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 2, 0 ), 1.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.get_4d.js b/test/test.instance.get_4d.js deleted file mode 100644 index 2fc6d8c..0000000 --- a/test/test.instance.get_4d.js +++ /dev/null @@ -1,931 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method which throws an error if not provided an integer value (4d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ], 0 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 1 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 2 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 3 ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value, dim ) { - if ( dim === 0 ) { - return i; - } - if ( dim === 1 ) { - return j; - } - if ( dim === 2 ) { - return k; - } - return l; - - function i() { - arr.get( value, 0, 0, 0 ); - } - - function j() { - arr.get( 0, value, 0, 0 ); - } - - function k() { - arr.get( 0, 0, value, 0 ); - } - - function l() { - arr.get( 0, 0, 0, value ); - } - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0, 0, 0, 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.get( 0, 0, 0, 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.get( 0, 0, 1, 0 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.get( 0, 0, 1, 1 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; submode=[clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; submode=[clamp,clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; submode=[throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'throw', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; submode=[normalize,normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'normalize', 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; submode=[normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 10, 2, 2, 0 ], - [ -2, 6, -1, 9 ], - [ -5, -3, 4, -5 ], - [ 5, 5, 5, 5 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; row-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (4d; column-major; submode=[wrap,wrap,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 10, 2, 2, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( -2, 6, -1, 9 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( -5, -3, 4, -5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 5, 5, 5, 5 ), 4.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.get_nd.js b/test/test.instance.get_nd.js deleted file mode 100644 index b80a4c7..0000000 --- a/test/test.instance.get_nd.js +++ /dev/null @@ -1,874 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method which throws an error if not provided an integer value (>4d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - var j; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - for ( j = 0; j < shape.length; j++ ) { - t.throws( badValue( values[ i ], j ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - } - t.end(); - - function badValue( value, dim ) { - return function badValue() { - var args = new Array( shape.length ); - var i; - - for ( i = 0; i < args.length; i++ ) { - if ( i === dim ) { - args[ i ] = value; - } else { - args[ i ] = 0; - } - } - arr.get.apply( arr, args ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1, 0, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.get( 0, 0, 0, 0, 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.get( 0, 0, 0, 0, 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.get( 0, 0, 0, 1, 0 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.get( 0, 0, 0, 1, 1 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -1, -1, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -1, -1, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -10, -10, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -10, -10, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -1, -1, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -1, -1, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; submode=[clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; submode=[clamp,clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; submode=[throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'throw', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -1, -1, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; submode=[throw,throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'throw', 'throw', 'throw' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -1, -1, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; submode=[normalize,normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'normalize', 'normalize' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 0, 10, 10, 0, 0 ], - [ 0, 0, 5, 0, 0 ], - [ 0, 5, 6, 0, 0 ], - [ 0, -10, -10, 0, 0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.get.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; row-major; submode=[wrap,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'row-major'; - strides = [ 4, 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `get` method for retrieving an array element using subscripts (>4d; column-major; submode=[wrap,wrap,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap', 'clamp', 'clamp' ] - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2, 1, 1 ]; - order = 'column-major'; - strides = [ 1, 1, 2, 4, 4 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.get( 0, 10, 10, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 5, 0, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 5, 6, 0, 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, -1, -1, 0, 0 ), 2.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.iget.js b/test/test.instance.iget.js deleted file mode 100644 index b61e3e4..0000000 --- a/test/test.instance.iget.js +++ /dev/null @@ -1,87 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'iget' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'iget' ), true, 'has property' ); - t.strictEqual( isFunction( arr.iget ), true, 'has method' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'iget' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'iget' ), true, 'has property' ); - t.strictEqual( isFunction( arr.iget ), true, 'has method' ); - - t.end(); -}); diff --git a/test/test.instance.iget_0d.js b/test/test.instance.iget_0d.js deleted file mode 100644 index 3af2790..0000000 --- a/test/test.instance.iget_0d.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget(), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element (0d; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget(); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.iget_1d.js b/test/test.instance.iget_1d.js deleted file mode 100644 index 0f1e164..0000000 --- a/test/test.instance.iget_1d.js +++ /dev/null @@ -1,1335 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method which throws an error if not provided an integer value (1d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=wrap; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( -2 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=wrap; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( -2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=wrap; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( -2 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=wrap; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( -2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=clamp; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( -1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=clamp; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( -1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=clamp; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( -1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 6 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=clamp; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - var v; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( -1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - - values = [ - [ 5 ], - [ 6 ], - [ -10 ], - [ -20 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -10 ], - [ -20 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -10 ], - [ -20 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 5 ], - [ 6 ], - [ -10 ], - [ -20 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (1d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 5 ], - [ 6 ], - [ -1 ], - [ -2 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iget_2d.js b/test/test.instance.iget_2d.js deleted file mode 100644 index 4de9463..0000000 --- a/test/test.instance.iget_2d.js +++ /dev/null @@ -1,1930 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method which throws an error if not provided an integer value (2d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iget_3d.js b/test/test.instance.iget_3d.js deleted file mode 100644 index 3fa528b..0000000 --- a/test/test.instance.iget_3d.js +++ /dev/null @@ -1,1854 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method which throws an error if not provided an integer value (3d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iget_4d.js b/test/test.instance.iget_4d.js deleted file mode 100644 index 561aee2..0000000 --- a/test/test.instance.iget_4d.js +++ /dev/null @@ -1,1854 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method which throws an error if not provided an integer value (4d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iget_nd.js b/test/test.instance.iget_nd.js deleted file mode 100644 index 2ab95be..0000000 --- a/test/test.instance.iget_nd.js +++ /dev/null @@ -1,1854 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method which throws an error if not provided an integer value (>4d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget( value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var v; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - v = arr.iget( 0 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - v = arr.iget( 1 ); - t.strictEqual( realf( v ), 1.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 2.0, 'returns expected value' ); - - v = arr.iget( 2 ); - t.strictEqual( realf( v ), 7.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 8.0, 'returns expected value' ); - - v = arr.iget( 3 ); - t.strictEqual( realf( v ), 5.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 6.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 1.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 2.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 3.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - t.strictEqual( arr.iget( 4 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 5 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( -2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( -1 ), 4.0, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4 ], - [ 5 ], - [ -20 ], - [ -10 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iget` method for retrieving an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4 ], - [ 5 ], - [ -2 ], - [ -1 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iget.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iset.js b/test/test.instance.iset.js deleted file mode 100644 index 9f1904a..0000000 --- a/test/test.instance.iset.js +++ /dev/null @@ -1,87 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'iset' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'iset' ), true, 'has property' ); - t.strictEqual( isFunction( arr.iset ), true, 'has method' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'iset' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'iset' ), true, 'has property' ); - t.strictEqual( isFunction( arr.iset ), true, 'has method' ); - - t.end(); -}); diff --git a/test/test.instance.iset_0d.js b/test/test.instance.iset_0d.js deleted file mode 100644 index b6fb28e..0000000 --- a/test/test.instance.iset_0d.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0 ]; - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 5.0 ); - - t.strictEqual( arr.iget(), 5.0, 'returns expected value' ); - t.deepEqual( buffer, [ 1.0, 5.0, 3.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.iset_1d.js b/test/test.instance.iset_1d.js deleted file mode 100644 index f09476f..0000000 --- a/test/test.instance.iset_1d.js +++ /dev/null @@ -1,1119 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method which throws an error if not provided an integer value for the first argument (1d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset( value, 0.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 7.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 7.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 7.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 7.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -1, 7.0 ); - arr.iset( -2, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -10, 7.0 ], - [ -20, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -10, 7.0 ], - [ -20, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -10, 7.0 ], - [ -20, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -10, 7.0 ], - [ -20, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (1d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iset_2d.js b/test/test.instance.iset_2d.js deleted file mode 100644 index b70b4de..0000000 --- a/test/test.instance.iset_2d.js +++ /dev/null @@ -1,1711 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method which throws an error if not provided an integer value for the first argument (2d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset( value, 0.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7, 8, 5, 6 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iset_3d.js b/test/test.instance.iset_3d.js deleted file mode 100644 index 3115fc0..0000000 --- a/test/test.instance.iset_3d.js +++ /dev/null @@ -1,1711 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method which throws an error if not provided an integer value for the first argument (3d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset( value, 0.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7, 8, 5, 6 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iset_4d.js b/test/test.instance.iset_4d.js deleted file mode 100644 index 79be1f9..0000000 --- a/test/test.instance.iset_4d.js +++ /dev/null @@ -1,1711 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method which throws an error if not provided an integer value for the first argument (4d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset( value, 0.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7, 8, 5, 6 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.iset_nd.js b/test/test.instance.iset_nd.js deleted file mode 100644 index b275a4e..0000000 --- a/test/test.instance.iset_nd.js +++ /dev/null @@ -1,1711 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method which throws an error if not provided an integer value for the first argument (>4d)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset( value, 0.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.iset( 0, 5.0 ); - arr.iset( 1, 6.0 ); - arr.iset( 2, 7.0 ); - arr.iset( 3, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7, 8, 5, 6 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.iset( 4, 5.0 ); - arr.iset( 5, 6.0 ); - arr.iset( -2, 7.0 ); - arr.iset( -1, 8.0 ); - - t.strictEqual( arr.iget( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 2.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 3.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 2.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has an `iset` method for setting an array element using a linear index (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -2, 7.0 ], - [ -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.iget( 0 ), 4.0, 'returns expected value' ); - t.strictEqual( arr.iget( 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.iget( 2 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.iget( 3 ), 1.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.iset.apply( arr, value ); - }; - } -}); diff --git a/test/test.instance.properties.js b/test/test.instance.properties.js deleted file mode 100644 index 156f292..0000000 --- a/test/test.instance.properties.js +++ /dev/null @@ -1,1128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive; -var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert-is-plain-object' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `byteLength` property specifying the size (in bytes) of the array (typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'byteLength' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'byteLength' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.byteLength ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.byteLength, 8*buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `byteLength` property specifying the size (in bytes) of the array (typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'byteLength' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'byteLength' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.byteLength ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.byteLength, 8*buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `byteLength` property specifying the size (in bytes) of the array (complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'byteLength' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'byteLength' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.byteLength ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.byteLength, 8*buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `byteLength` property specifying the size (in bytes) of the array (complex typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'byteLength' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'byteLength' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.byteLength ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.byteLength, 8*buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `byteLength` property specifying the size (in bytes) of an array (generic)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'byteLength' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'byteLength' ), true, 'has property' ); - t.strictEqual( arr.byteLength, null, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `byteLength` property specifying the size (in bytes) of an array (generic; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0 ]; - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'byteLength' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'byteLength' ), true, 'has property' ); - t.strictEqual( arr.byteLength, null, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `BYTES_PER_ELEMENT` property specifying the size (in bytes) of each array element (typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'BYTES_PER_ELEMENT' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( isPositiveInteger( arr.BYTES_PER_ELEMENT ), true, 'is a positive integer' ); - t.strictEqual( arr.BYTES_PER_ELEMENT, 8, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `BYTES_PER_ELEMENT` property specifying the size (in bytes) of each array element (typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'BYTES_PER_ELEMENT' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( isPositiveInteger( arr.BYTES_PER_ELEMENT ), true, 'is a positive integer' ); - t.strictEqual( arr.BYTES_PER_ELEMENT, 8, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `BYTES_PER_ELEMENT` property specifying the size (in bytes) of each array element (complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'BYTES_PER_ELEMENT' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( isPositiveInteger( arr.BYTES_PER_ELEMENT ), true, 'is a positive integer' ); - t.strictEqual( arr.BYTES_PER_ELEMENT, 8, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `BYTES_PER_ELEMENT` property specifying the size (in bytes) of each array element (complex typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'BYTES_PER_ELEMENT' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( isPositiveInteger( arr.BYTES_PER_ELEMENT ), true, 'is a positive integer' ); - t.strictEqual( arr.BYTES_PER_ELEMENT, 8, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `BYTES_PER_ELEMENT` property specifying the size (in bytes) of each array element (generic)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'BYTES_PER_ELEMENT' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( arr.BYTES_PER_ELEMENT, null, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `BYTES_PER_ELEMENT` property specifying the size (in bytes) of each array element (generic; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0 ]; - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'BYTES_PER_ELEMENT' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'BYTES_PER_ELEMENT' ), true, 'has property' ); - t.strictEqual( arr.BYTES_PER_ELEMENT, null, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `data` property pointing to the underlying data buffer', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'data' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'data' ), true, 'has property' ); - t.strictEqual( arr.data, buffer, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `data` property pointing to the underlying data buffer (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'data' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'data' ), true, 'has property' ); - t.strictEqual( arr.data, buffer, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `data` property pointing to the underlying data buffer (complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'data' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'data' ), true, 'has property' ); - t.strictEqual( arr.data, buffer, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `data` property pointing to the underlying data buffer (complex typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'data' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'data' ), true, 'has property' ); - t.strictEqual( arr.data, buffer, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `dtype` property specifying the underlying data type', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'dtype' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'dtype' ), true, 'has property' ); - t.strictEqual( arr.dtype, dtype, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `dtype` property specifying the underlying data type (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'dtype' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'dtype' ), true, 'has property' ); - t.strictEqual( arr.dtype, dtype, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `dtype` property specifying the underlying data type (complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'dtype' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'dtype' ), true, 'has property' ); - t.strictEqual( arr.dtype, dtype, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `dtype` property specifying the underlying data type (complex typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'dtype' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'dtype' ), true, 'has property' ); - t.strictEqual( arr.dtype, dtype, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `flags` property providing information regarding the memory layout of the array (row-major contiguous)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'flags' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'flags' ), true, 'has property' ); - t.strictEqual( isPlainObject( arr.flags ), true, 'is an object' ); - - t.strictEqual( hasOwnProp( arr.flags, 'ROW_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.ROW_MAJOR_CONTIGUOUS, true, 'has expected value' ); - - t.strictEqual( hasOwnProp( arr.flags, 'COLUMN_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.COLUMN_MAJOR_CONTIGUOUS, false, 'has expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `flags` property providing information regarding the memory layout of the array (column-major contiguous)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'flags' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'flags' ), true, 'has property' ); - t.strictEqual( isPlainObject( arr.flags ), true, 'is an object' ); - - t.strictEqual( hasOwnProp( arr.flags, 'ROW_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.ROW_MAJOR_CONTIGUOUS, false, 'has expected value' ); - - t.strictEqual( hasOwnProp( arr.flags, 'COLUMN_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.COLUMN_MAJOR_CONTIGUOUS, true, 'has expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `flags` property providing information regarding the memory layout of the array (row-major and column-major contiguous)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'flags' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'flags' ), true, 'has property' ); - t.strictEqual( isPlainObject( arr.flags ), true, 'is an object' ); - - t.strictEqual( hasOwnProp( arr.flags, 'ROW_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.ROW_MAJOR_CONTIGUOUS, true, 'has expected value' ); - - t.strictEqual( hasOwnProp( arr.flags, 'COLUMN_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.COLUMN_MAJOR_CONTIGUOUS, true, 'has expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `flags` property providing information regarding the memory layout of the array (row-major and column-major contiguous; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'flags' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'flags' ), true, 'has property' ); - t.strictEqual( isPlainObject( arr.flags ), true, 'is an object' ); - - t.strictEqual( hasOwnProp( arr.flags, 'ROW_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.ROW_MAJOR_CONTIGUOUS, true, 'has expected value' ); - - t.strictEqual( hasOwnProp( arr.flags, 'COLUMN_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.COLUMN_MAJOR_CONTIGUOUS, true, 'has expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `flags` property providing information regarding the memory layout the array (neither row-major nor column-major contiguous)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ); - shape = [ 2, 2, 2 ]; - order = 'column-major'; - strides = [ 4, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'flags' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'flags' ), true, 'has property' ); - t.strictEqual( isPlainObject( arr.flags ), true, 'is an object' ); - - t.strictEqual( hasOwnProp( arr.flags, 'ROW_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.ROW_MAJOR_CONTIGUOUS, false, 'has expected value' ); - - t.strictEqual( hasOwnProp( arr.flags, 'COLUMN_MAJOR_CONTIGUOUS' ), true, 'has own property' ); - t.strictEqual( arr.flags.COLUMN_MAJOR_CONTIGUOUS, false, 'has expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `length` property specifying the number of array elements', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'length' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'length' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.length ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.length, buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `length` property specifying the number of array elements (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'length' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'length' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.length ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.length, buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `length` property specifying the number of array elements (complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'length' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'length' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.length ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.length, buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `length` property specifying the number of array elements (complex typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'length' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'length' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.length ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.length, buffer.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `ndims` property specifying the number of array dimensions', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'ndims' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'ndims' ), true, 'has property' ); - t.strictEqual( isPositiveInteger( arr.ndims ), true, 'is a positive integer' ); - t.strictEqual( arr.ndims, shape.length, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `ndims` property specifying the number of array dimensions (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'ndims' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'ndims' ), true, 'has property' ); - t.strictEqual( arr.ndims, 0, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `offset` property specifying the location of the first indexed element', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'offset' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'offset' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.offset ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.offset, offset, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `offset` property specifying the location of the first indexed element (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'offset' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'offset' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.offset ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.offset, offset, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `offset` property specifying the location of the first indexed element (complex typed)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); // eslint-disable-line max-len - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'offset' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'offset' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.offset ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.offset, offset, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `offset` property specifying the location of the first indexed element (complex typed; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'offset' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'offset' ), true, 'has property' ); - t.strictEqual( isNonNegativeInteger( arr.offset ), true, 'is a nonnegative integer' ); - t.strictEqual( arr.offset, offset, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `order` property specifying the array order (row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'order' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'order' ), true, 'has property' ); - t.strictEqual( arr.order, order, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `order` property specifying the array order (row-major; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'order' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'order' ), true, 'has property' ); - t.strictEqual( arr.order, order, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `order` property specifying the array order (column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'order' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'order' ), true, 'has property' ); - t.strictEqual( arr.order, order, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has an `order` property specifying the array order (column-major; 0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'column-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'order' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'order' ), true, 'has property' ); - t.strictEqual( arr.order, order, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `shape` property specifying the array shape (dimensions)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'shape' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'shape' ), true, 'has property' ); - t.notEqual( arr.shape, shape, 'returns a copy' ); - t.deepEqual( arr.shape, shape, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `shape` property specifying the array shape (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'column-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'shape' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'shape' ), true, 'has property' ); - t.notEqual( arr.shape, shape, 'returns a copy' ); - t.deepEqual( arr.shape, shape, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `strides` property specifying how to access array elements along corresponding dimensions', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'strides' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'strides' ), true, 'has property' ); - t.notEqual( arr.strides, strides, 'returns a copy' ); - t.deepEqual( arr.strides, strides, 'has expected value' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `strides` property specifying how to access array elements along corresponding dimensions (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'strides' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'strides' ), true, 'has property' ); - t.notEqual( arr.strides, strides, 'returns a copy' ); - t.deepEqual( arr.strides, strides, 'has expected value' ); - t.end(); -}); diff --git a/test/test.instance.set.js b/test/test.instance.set.js deleted file mode 100644 index 25d2714..0000000 --- a/test/test.instance.set.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'set' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'set' ), true, 'has property' ); - t.strictEqual( isFunction( arr.set ), true, 'has method' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'set' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'set' ), true, 'has property' ); - t.strictEqual( isFunction( arr.set ), true, 'has method' ); - t.end(); -}); diff --git a/test/test.instance.set_0d.js b/test/test.instance.set_0d.js deleted file mode 100644 index 3497660..0000000 --- a/test/test.instance.set_0d.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method which throws an error if provided index arguments (0d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 0, - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set( value, 10.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 5.0 ); - - t.strictEqual( arr.get(), 5.0, 'returns expected value' ); - t.deepEqual( buffer, [ 1.0, 2.0, 5.0, 4.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.set_1d.js b/test/test.instance.set_1d.js deleted file mode 100644 index 6fc14d7..0000000 --- a/test/test.instance.set_1d.js +++ /dev/null @@ -1,940 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method which throws an error if not provided an integer value for a dimension index (1d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set( value, 10.0 ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 5.0 ); - arr.set( 1, 6.0 ); - arr.set( 2, 7.0 ); - arr.set( 3, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 5.0 ); - arr.set( 1, 6.0 ); - arr.set( 2, 7.0 ); - arr.set( 3, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( 6, 7.0 ); - arr.set( 7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( 6, 7.0 ); - arr.set( 7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( -1, 7.0 ); - arr.set( -2, 8.0 ); - - t.strictEqual( arr.get( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( -1, 7.0 ); - arr.set( -7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -10, 7.0 ], - [ -20, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - arr.set( 0, 5.0 ); - arr.set( 1, 6.0 ); - arr.set( -2, 7.0 ); - arr.set( -1, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -10, 7.0 ], - [ -20, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - arr.set( 0, 5.0 ); - arr.set( 1, 6.0 ); - arr.set( -2, 7.0 ); - arr.set( -1, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( 6, 7.0 ); - arr.set( 7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( 6, 7.0 ); - arr.set( 7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( -1, 7.0 ); - arr.set( -2, 8.0 ); - - t.strictEqual( arr.get( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( -1, 7.0 ); - arr.set( -7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'wrap', - 'submode': [ 'throw' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; submode=[throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'clamp', - 'submode': [ 'throw', 'throw' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 4, 5.0 ], - [ 5, 6.0 ], - [ -1, 7.0 ], - [ -2, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.strictEqual( arr.get( 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; row-major; submode=[wrap,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'throw' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( 6, 7.0 ); - arr.set( 7, 8.0 ); - - t.strictEqual( arr.get( 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (1d; column-major; submode=[clamp,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'throw' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 4 ]; - order = 'column-major'; - strides = [ 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 4, 5.0 ); - arr.set( 5, 6.0 ); - arr.set( -1, 7.0 ); - arr.set( -2, 8.0 ); - - t.strictEqual( arr.get( 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 2 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 3 ), 6.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 2.0, 3.0, 6.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.set_2d.js b/test/test.instance.set_2d.js deleted file mode 100644 index fcc34a2..0000000 --- a/test/test.instance.set_2d.js +++ /dev/null @@ -1,1250 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method which throws an error if not provided an integer value for a dimension index (2d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ], 0 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 1 ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value, dim ) { - if ( dim === 0 ) { - return i; - } - return j; - - function i() { - arr.set( value, 0, 10.0 ); - } - - function j() { - arr.set( 0, value, 10.0 ); - } - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, -1 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 5.0, 8.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ -2, -1 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 7.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, 2 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 5.0, 8.0, 6.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, -2 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 6.0, 8.0, 5.0, 7.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( 1, 0, 7.0 ); - arr.set( 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 8.0, 6.0, 7.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 1, 0, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 6.0, 5.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 1, 0, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 5.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -2, 3, 6.0 ], - [ -1, -2, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -2, 3, 6.0 ], - [ -1, -2, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -20, 3, 6.0 ], - [ -1, -20, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( -1, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; mode=normalize)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'normalize' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -20, 3, 6.0 ], - [ -1, -20, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - arr.set( 0, 0, 5.0 ); - arr.set( 0, 1, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( -1, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 1, 10, 5.0 ], - [ -2, 3, 6.0 ], - [ -1, -2, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 1, 10, 5.0 ], - [ -2, 3, 6.0 ], - [ -1, -2, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; submode=[clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 1, 0, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 6.0, 5.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 1, 0, 5.0 ); - arr.set( -2, 3, 6.0 ); - arr.set( -1, -2, 7.0 ); - arr.set( 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 5.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; submode=[throw,throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw', 'throw', 'throw' ], - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -2, 3, 6.0 ], - [ -1, -2, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw' ], - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -2, 3, 6.0 ], - [ -1, -2, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; submode=[normalize,normalize,normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'normalize', 'normalize', 'normalize' ], - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -20, 3, 6.0 ], - [ -1, -20, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; submode=[normalize])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'normalize' ], - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 1, 10, 5.0 ], - [ -20, 3, 6.0 ], - [ -1, -20, 7.0 ], - [ 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; row-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 5.0 ); // (0,1) - arr.set( -2, 3, 6.0 ); // (0,1) - arr.set( -1, -2, 7.0 ); // (1,0) - arr.set( 5, 5, 8.0 ); // (1,1) - - t.strictEqual( arr.get( 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (2d; column-major; submode=[clamp,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 5.0 ); // (1,0) - arr.set( -2, 3, 6.0 ); // (0,1) - arr.set( -1, -2, 7.0 ); // (0,0) - arr.set( 5, 5, 8.0 ); // (1,1) - - t.strictEqual( arr.get( 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 5.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.set_3d.js b/test/test.instance.set_3d.js deleted file mode 100644 index 708c941..0000000 --- a/test/test.instance.set_3d.js +++ /dev/null @@ -1,834 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method which throws an error if not provided an integer value for a dimension index (3d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ], 0 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 1 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 2 ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value, dim ) { - if ( dim === 0 ) { - return i; - } - if ( dim === 1 ) { - return j; - } - return k; - - function i() { - arr.set( value, 0, 0, 10.0 ); - } - - function j() { - arr.set( 0, value, 0, 10.0 ); - } - - function k() { - arr.set( 0, 0, value, 10.0 ); - } - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 0, 5.0 ); - arr.set( 0, 0, 1, 6.0 ); - arr.set( 0, 1, 0, 7.0 ); - arr.set( 0, 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 0, 5.0 ); - arr.set( 0, 0, 1, 6.0 ); - arr.set( 0, 1, 0, 7.0 ); - arr.set( 0, 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 5.0 ], - [ -4, -2, 11, 6.0 ], - [ 0, 5, 0, 7.0 ], - [ 0, 15, -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 5.0 ], - [ -4, -2, 11, 6.0 ], - [ 0, 5, 0, 7.0 ], - [ 0, 15, -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 2, 2, 2, 5.0 ], - [ -4, -2, 11, 6.0 ], - [ 0, 5, 0, 7.0 ], - [ 0, 15, -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 2, 2, 2, 5.0 ], - [ -4, -2, 11, 6.0 ], - [ 0, 5, 0, 7.0 ], - [ 0, 15, -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; submode=[clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; submode=[clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); - arr.set( -4, -2, 11, 6.0 ); - arr.set( 0, 5, 0, 7.0 ); - arr.set( 0, 15, -1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; submode=[throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw', 'throw' ], - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 5.0 ], - [ -4, -2, 11, 6.0 ], - [ 0, 5, 0, 7.0 ], - [ 0, 15, -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw' ], - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 5.0 ], - [ -4, -2, 11, 6.0 ], - [ 0, 5, 0, 7.0 ], - [ 0, 15, -1, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; row-major; submode=[wrap,wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); // (0,0,1) - arr.set( -4, -2, 11, 6.0 ); // (0,0,1) - arr.set( 0, 5, 0, 7.0 ); // (0,1,0) - arr.set( 0, 15, -1, 8.0 ); // (0,1,0) - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 8.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (3d; column-major; submode=[clamp,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 5.0 ); // (0,0,1) - arr.set( -4, -2, 11, 6.0 ); // (0,0,1) - arr.set( 0, 5, 0, 7.0 ); // (0,1,0) - arr.set( 0, 15, -1, 8.0 ); // (0,1,0) - - t.strictEqual( arr.get( 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 0 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 8.0, 6.0, 4.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.set_4d.js b/test/test.instance.set_4d.js deleted file mode 100644 index 9090bdd..0000000 --- a/test/test.instance.set_4d.js +++ /dev/null @@ -1,842 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method which throws an error if not provided an integer value for a dimension index (4d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ], 0 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 1 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 2 ), TypeError, 'throws an error when provided ' + values[ i ] ); - t.throws( badValue( values[ i ], 3 ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value, dim ) { - if ( dim === 0 ) { - return i; - } - if ( dim === 1 ) { - return j; - } - if ( dim === 2 ) { - return k; - } - return l; - - function i() { - arr.set( value, 0, 0, 0, 10.0 ); - } - - function j() { - arr.set( 0, value, 0, 0, 10.0 ); - } - - function k() { - arr.set( 0, 0, value, 0, 10.0 ); - } - - function l() { - arr.set( 0, 0, 0, value, 10.0 ); - } - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 0, 0, 5.0 ); - arr.set( 0, 0, 0, 1, 6.0 ); - arr.set( 0, 0, 1, 0, 7.0 ); - arr.set( 0, 0, 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 0, 0, 5.0 ); - arr.set( 0, 0, 0, 1, 6.0 ); - arr.set( 0, 0, 1, 0, 7.0 ); - arr.set( 0, 0, 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 6.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 2.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 11, 6.0 ], - [ 0, 0, -1, 0, 7.0 ], - [ 0, 0, 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 11, 6.0 ], - [ 0, 0, -1, 0, 7.0 ], - [ 0, 0, 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 11, 6.0 ], - [ 0, 0, -1, 0, 7.0 ], - [ 0, 0, 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 11, 6.0 ], - [ 0, 0, -1, 0, 7.0 ], - [ 0, 0, 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; submode=[clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 6.0, 3.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; submode=[clamp,clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, -1, 0, 7.0 ); - arr.set( 0, 0, 5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 2.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw' ], - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 11, 6.0 ], - [ 0, 0, -1, 0, 7.0 ], - [ 0, 0, 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; submode=[throw,throw,throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw', 'throw', 'throw', 'throw' ], - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 11, 6.0 ], - [ 0, 0, -1, 0, 7.0 ], - [ 0, 0, 5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; row-major; submode=[wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); // (0,0,0,1) - arr.set( 0, 0, 0, 11, 6.0 ); // (0,0,0,1) - arr.set( 0, 0, -1, 0, 7.0 ); // (0,0,1,0) - arr.set( 0, 0, 5, 5, 8.0 ); // (0,0,1,1) - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (4d; column-major; submode=[wrap,clamp,clamp,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'clamp', 'clamp', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 5.0 ); // (0,0,1,0) - arr.set( 0, 0, 0, 11, 6.0 ); // (0,0,0,1) - arr.set( 0, 0, -1, 0, 7.0 ); // (0,0,0,0) - arr.set( 0, 0, 5, 5, 8.0 ); // (0,0,1,1) - - t.strictEqual( arr.get( 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 5.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.set_nd.js b/test/test.instance.set_nd.js deleted file mode 100644 index 12260de..0000000 --- a/test/test.instance.set_nd.js +++ /dev/null @@ -1,830 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method which throws an error if not provided an integer value for a dimension index (>4d)', function test( t ) { - var strides; - var values; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - var i; - var j; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1, 1, 1, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - '5', - 3.14, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - for ( j = 0; j < shape.length; j++ ) { - t.throws( badValue( values[ i ], j ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - } - t.end(); - - function badValue( value, dim ) { - return function badValue() { - var args = new Array( shape.length+1 ); - var i; - - for ( i = 0; i < shape.length; i++ ) { - if ( i === dim ) { - args[ i ] = value; - } else { - args[ i ] = 0; - } - } - args[ i ] = 10.0; - arr.set.apply( arr, args ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 0, 0, 0, 5.0 ); - arr.set( 0, 0, 0, 0, 1, 6.0 ); - arr.set( 0, 0, 0, 1, 0, 7.0 ); - arr.set( 0, 0, 0, 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - arr.set( 0, 0, 0, 0, 0, 5.0 ); - arr.set( 0, 0, 0, 0, 1, 6.0 ); - arr.set( 0, 0, 0, 1, 0, 7.0 ); - arr.set( 0, 0, 0, 1, 1, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; mode=wrap)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 3.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; mode=clamp)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 2.0, 8.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 0, 11, 6.0 ], - [ 0, 0, 0, -1, -10, 7.0 ], - [ 0, 0, 0, -5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; mode=throw)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'mode': 'throw' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 0, 11, 6.0 ], - [ 0, 0, 0, -1, -10, 7.0 ], - [ 0, 0, 0, -5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 2, 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 0, 11, 6.0 ], - [ 0, 0, 0, -1, -10, 7.0 ], - [ 0, 0, 0, -5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; mode=default)', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var arr; - var i; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - values = [ - [ 2, 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 0, 11, 6.0 ], - [ 0, 0, 0, -1, -10, 7.0 ], - [ 0, 0, 0, -5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; submode=[wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 6.0, 7.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; submode=[wrap,wrap])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 5.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; submode=[clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 3.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; submode=[clamp,clamp,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'clamp', 'clamp', 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); - arr.set( 0, 0, 0, 0, 11, 6.0 ); - arr.set( 0, 0, 0, -1, -10, 7.0 ); - arr.set( 0, 0, 0, -5, 5, 8.0 ); - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 5.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 2.0, 8.0, 5.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; submode=[throw,throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw', 'throw' ], - 'mode': 'wrap' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 0, 11, 6.0 ], - [ 0, 0, 0, -1, -10, 7.0 ], - [ 0, 0, 0, -5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; submode=[throw])', function test( t ) { - var strides; - var buffer; - var offset; - var values; - var dtype; - var order; - var shape; - var opts; - var arr; - var i; - - opts = { - 'submode': [ 'throw' ], - 'mode': 'clamp' - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - values = [ - [ 2, 2, 2, 2, 2, 5.0 ], - [ 0, 0, 0, 0, 11, 6.0 ], - [ 0, 0, 0, -1, -10, 7.0 ], - [ 0, 0, 0, -5, 5, 8.0 ] - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided arguments: ' + values[ i ] ); - } - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 3.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 2.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 2.0, 3.0, 4.0 ], 'has expected values' ); - - t.end(); - - function badValue( value ) { - return function badValue() { - arr.set.apply( arr, value ); - }; - } -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; row-major; submode=[wrap,wrap,clamp,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap', 'clamp', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'row-major'; - strides = [ 4, 4, 4, 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); // (0,0,0,1,0) - arr.set( 0, 0, 0, 0, 11, 6.0 ); // (0,0,0,0,1) - arr.set( 0, 0, 0, -1, -10, 7.0 ); // (0,0,0,0,0) - arr.set( 0, 0, 0, -5, 5, 8.0 ); // (0,0,0,0,1) - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 8.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 5.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 4.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 7.0, 8.0, 5.0, 4.0 ], 'has expected values' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a `set` method for setting an array element using subscripts (>4d; column-major; submode=[wrap,wrap,wrap,wrap,clamp])', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var opts; - var arr; - - opts = { - 'submode': [ 'wrap', 'wrap', 'wrap', 'wrap', 'clamp' ] - }; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 1, 1, 1, 2, 2 ]; - order = 'column-major'; - strides = [ 1, 1, 1, 1, 2 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, opts ); - - arr.set( 2, 2, 2, 2, 2, 5.0 ); // (0,0,0,0,1) - arr.set( 0, 0, 0, 0, 11, 6.0 ); // (0,0,0,0,1) - arr.set( 0, 0, 0, -1, -10, 7.0 ); // (0,0,0,1,0) - arr.set( 0, 0, 0, -5, 5, 8.0 ); // (0,0,0,1,1) - - t.strictEqual( arr.get( 0, 0, 0, 0, 0 ), 1.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 0, 1 ), 6.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 0 ), 7.0, 'returns expected value' ); - t.strictEqual( arr.get( 0, 0, 0, 1, 1 ), 8.0, 'returns expected value' ); - - t.deepEqual( buffer, [ 1.0, 7.0, 6.0, 8.0 ], 'has expected values' ); - - t.end(); -}); diff --git a/test/test.instance.tojson.js b/test/test.instance.tojson.js deleted file mode 100644 index 10ab3a5..0000000 --- a/test/test.instance.tojson.js +++ /dev/null @@ -1,202 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toJSON()` method (row-major)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'float64'; - buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toJSON' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toJSON' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toJSON ), true, 'has method' ); - - expected = { - 'type': 'ndarray', - 'dtype': 'float64', - 'data': [ 3.0, 4.0, 5.0, 6.0 ], - 'shape': [ 2, 2 ], - 'strides': [ 2, 1 ], - 'order': 'row-major', - 'flags': { - 'READONLY': false - } - }; - actual = arr.toJSON(); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toJSON()` method (column-major)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toJSON' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toJSON' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toJSON ), true, 'has method' ); - - expected = { - 'type': 'ndarray', - 'dtype': 'generic', - 'data': [ 4.0, 3.0, 2.0, 1.0 ], - 'shape': [ 2, 2 ], - 'strides': [ 1, 2 ], - 'order': 'column-major', - 'flags': { - 'READONLY': false - } - }; - actual = arr.toJSON(); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toJSON()` method (0d)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = []; - order = 'column-major'; - strides = [ 0 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toJSON' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toJSON' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toJSON ), true, 'has method' ); - - expected = { - 'type': 'ndarray', - 'dtype': 'generic', - 'data': [ 3.0 ], - 'shape': [], - 'strides': [ 0 ], - 'order': 'column-major', - 'flags': { - 'READONLY': false - } - }; - actual = arr.toJSON(); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toJSON()` method (complex type)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toJSON' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toJSON' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toJSON ), true, 'has method' ); - - expected = { - 'type': 'ndarray', - 'dtype': 'complex64', - 'data': [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], - 'shape': [ 2, 2 ], - 'strides': [ 2, 1 ], - 'order': 'row-major', - 'flags': { - 'READONLY': false - } - }; - actual = arr.toJSON(); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.instance.tostring.js b/test/test.instance.tostring.js deleted file mode 100644 index 95eba28..0000000 --- a/test/test.instance.tostring.js +++ /dev/null @@ -1,309 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasOwnProp = require( '@stdlib/assert-has-own-property' ); -var hasProp = require( '@stdlib/assert-has-property' ); -var isFunction = require( '@stdlib/assert-is-function' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex64 = require( '@stdlib/complex-float32-ctor' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (order=row-major)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 2; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'generic\', [ 3, 4, 5, 6 ], [ 2, 2 ], [ 2, 1 ], 0, \'row-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (order=column-major)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'column-major'; - strides = [ -1, -2 ]; - offset = 3; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'generic\', [ 4, 3, 2, 1 ], [ 2, 2 ], [ 1, 2 ], 0, \'column-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (complex type)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'complex64\', new Complex64Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ), [ 2, 2 ], [ 2, 1 ], 0, \'row-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (complex type)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex128'; - buffer = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'complex128\', new Complex128Array( [ 1, 2, 3, 4, 5, 6, 7, 8 ] ), [ 2, 2 ], [ 2, 1 ], 0, \'row-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (large array)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = new Array( 1e4 ); - shape = [ buffer.length ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - buffer[ 0 ] = 1.0; - buffer[ 1 ] = 2.0; - buffer[ 2 ] = 3.0; - buffer[ buffer.length-3 ] = 4.0; - buffer[ buffer.length-2 ] = 5.0; - buffer[ buffer.length-1 ] = 6.0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'generic\', [ 1, 2, 3, ..., 4, 5, 6 ], [ 10000 ], [ 1 ], 0, \'row-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (large array; complex type)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( 1e4 ); - shape = [ buffer.length ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - buffer.set( new Complex64( 1.0, 1.0 ), 0 ); - buffer.set( new Complex64( 2.0, 2.0 ), 1 ); - buffer.set( new Complex64( 3.0, 3.0 ), 2 ); - buffer.set( new Complex64( 4.0, 4.0 ), buffer.length-3 ); - buffer.set( new Complex64( 5.0, 5.0 ), buffer.length-2 ); - buffer.set( new Complex64( 6.0, 6.0 ), buffer.length-1 ); - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'complex64\', new Complex64Array( [ 1, 1, 2, 2, 3, 3, ..., 4, 4, 5, 5, 6, 6 ] ), [ 10000 ], [ 1 ], 0, \'row-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (large array; complex type)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex128'; - buffer = new Complex128Array( 1e4 ); - shape = [ buffer.length ]; - order = 'row-major'; - strides = [ 1 ]; - offset = 0; - - buffer.set( new Complex128( 1.0, 1.0 ), 0 ); - buffer.set( new Complex128( 2.0, 2.0 ), 1 ); - buffer.set( new Complex128( 3.0, 3.0 ), 2 ); - buffer.set( new Complex128( 4.0, 4.0 ), buffer.length-3 ); - buffer.set( new Complex128( 5.0, 5.0 ), buffer.length-2 ); - buffer.set( new Complex128( 6.0, 6.0 ), buffer.length-1 ); - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'complex128\', new Complex128Array( [ 1, 1, 2, 2, 3, 3, ..., 4, 4, 5, 5, 6, 6 ] ), [ 10000 ], [ 1 ], 0, \'row-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'an ndarray constructor returns an instance which has a custom `toString()` method (0d)', function test( t ) { - var expected; - var strides; - var actual; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = []; - order = 'column-major'; - strides = [ 0 ]; - offset = 1; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( hasOwnProp( arr, 'toString' ), false, 'does not have own property' ); - t.strictEqual( hasProp( arr, 'toString' ), true, 'has property' ); - t.strictEqual( isFunction( arr.toString ), true, 'has method' ); - - expected = 'ndarray( \'generic\', [ 2 ], [], [ 0 ], 0, \'column-major\' )'; - actual = arr.toString(); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 5cdee94..0000000 --- a/test/test.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var ndarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function is an ndarray constructor', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = new ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the function is an ndarray constructor (complex dtype)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = new ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the function is an ndarray constructor (0d)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0 ]; - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = new ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the function is an ndarray constructor (0d; complex dtype)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'complex64'; - buffer = new Complex64Array( [ 1.0, 1.0 ] ); - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = new ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the function is an ndarray constructor (options)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = new ndarray( dtype, buffer, shape, strides, offset, order, {} ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the function is an ndarray constructor (0d; options)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0 ]; - shape = []; - order = 'row-major'; - strides = [ 0 ]; - offset = 0; - - arr = new ndarray( dtype, buffer, shape, strides, offset, order, {} ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); - -tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { - var strides; - var buffer; - var offset; - var dtype; - var order; - var shape; - var arr; - - dtype = 'generic'; - buffer = [ 1.0, 2.0, 3.0, 4.0 ]; - shape = [ 2, 2 ]; - order = 'row-major'; - strides = [ 2, 1 ]; - offset = 0; - - arr = ndarray( dtype, buffer, shape, strides, offset, order, {} ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns an instance' ); - t.end(); -}); diff --git a/test/test.validate.js b/test/test.validate.js deleted file mode 100644 index 3954beb..0000000 --- a/test/test.validate.js +++ /dev/null @@ -1,203 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var validate = require( './../lib/validate.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof validate, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an error if provided an `options` argument which is not an object', function test( t ) { - var values; - var err; - var i; - - values = [ - '5', - 5, - true, - false, - void 0, - null, - NaN, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, values[ i ] ); - t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns an error if provided an unrecognized/unsupported `mode` option', function test( t ) { - var values; - var opts; - var err; - var i; - - values = [ - '5', - 'beep', - 'boop', - 'foo', - 'bar', - 'throws', - 'wraps', - 'clamps', - 'normalizes', - 'clip', - 'clamped', - 'error', - 'err', - 5, - true, - false, - void 0, - null, - NaN, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - opts = { - 'mode': values[ i ] - }; - err = validate( {}, opts ); - t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns an error if provided a `submode` option which is not an array containing recognized/supported modes', function test( t ) { - var values; - var opts; - var err; - var i; - - values = [ - '5', - 'beep', - 'boop', - 'foo', - 'bar', - 'throws', - 'wraps', - 'clamps', - 'clip', - 'clamped', - 'error', - 'err', - 5, - true, - false, - void 0, - null, - NaN, - [], - [ 'throw', 'wrap', 'clamp', 'foo' ], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - opts = { - 'submode': values[ i ] - }; - err = validate( {}, opts ); - t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns an error if provided a `readonly` option which is not a boolean', function test( t ) { - var values; - var opts; - var err; - var i; - - values = [ - '5', - 5, - void 0, - null, - NaN, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - opts = { - 'readonly': values[ i ] - }; - err = validate( {}, opts ); - t.strictEqual( err instanceof TypeError, true, 'returns a type error when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns `null` if all options are valid', function test( t ) { - var options; - var opts; - var err; - - opts = {}; - options = { - 'mode': 'wrap', - 'submode': [ 'throw', 'wrap', 'clamp' ], - 'readonly': true - }; - - err = validate( opts, options ); - t.strictEqual( err, null, 'returns null' ); - t.deepEqual( opts, options, 'sets options' ); - - t.end(); -}); - -tape( 'the function will ignore unrecognized options', function test( t ) { - var options; - var opts; - var err; - - opts = {}; - options = { - 'beep': true, - 'boop': 'bop' - }; - - err = validate( opts, options ); - t.strictEqual( err, null, 'returns null' ); - t.deepEqual( opts, {}, 'ignores unrecognized options' ); - - t.end(); -});